Leveraging Gulp Zip to compress all files within a directory

Utilizing gulp-zip, I am zipping up my source files. My project consists of a main folder named FIFA, which includes subfolders with potentially more subfolders and files. Additionally, the FIFA folder contains essential files like package.json, gulp.js, among others. My goal is to use gulp-zip to compress the entire project into a folder named distribution and save the zip file there. Below is the code snippet I used:

gulp.task('zip', function () {
    return gulp.src('./*,')
        .pipe(zip('test.zip'))
        .pipe(gulp.dest('./distribution'));
});

However, an issue arises where the zip file created in the distribution folder only includes the files directly within the FIFA folder, excluding any nested files in subfolders. For example, if there is a subfolder named ronaldo inside FIFA, and it contains a file called goal.js, that file is missing from the zip archive. Can you help me identify what mistake I have made here? Any advice would be greatly appreciated.

Answer №1

Experiment with the power of two *

gulp.task('zip', function () {
    return gulp.src('./**')
        .pipe(zip('test.zip'))
        .pipe(gulp.dest('./distribution'));
});

What sets apart * from **?

A single star fetches all files excluding folders - while double stars delve deeper to encompass all folders inside the specified folder.

If one wanted to utilize double stars to include all folders EXCEPT a specific one, would it be viable?

You can introduce an exclamation mark like !./excludedDir, by supplying src as an array that comprises the !... value among others.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the process of implementing session storage in an AngularJS directive?

I am trying to save values in Angular session storage within an Angular directive, but I am facing an issue where I only receive NULL. Can anyone provide assistance? app.directive('myDirective', function (httpPostFactory) { return { restrict ...

Transform large GeoJSON files into TopoJSON format

I am struggling to convert a large GeoJSON file that is approximately 1.4GB in size. The command line tool is unable to handle the file due to its filesize. I typically use the topojson command tool like so: topojson {{ input file }} >> {{ output fi ...

Multi-View Routing in AngularJS with UI-Router: Implementing Nested States

I am currently working on an AngularJS project using ui-router and have set up a state with two side-by-side views: $stateProvider .state('side-by-side', {url: '/side-by-side', views: { 'listView': { templateUrl: ...

Ways to integrate npm dependencies into your Cordova plugin

Currently working on implementing a Cordova plugin called core-cordova found in this repository. This particular plugin has a dependency on another NPM package. The issue arises after installing the plugin in my app using: $ cordova plugin add @aerogears ...

Tips for managing accordion events using a button press

I found a script online that I want to modify. Specifically, I am looking to create a button that will control the accordion event by closing the current div and opening the next one. <button> Click me to open next</button> inside each div in ...

JavaScript issue: "No relay configuration found" error specifically occurs in Internet Explorer versions 7 and 8

Encountering issues with loading JavaScript only on specific pages in Internet Explorer. Safari, Firefox, and Chrome render the page correctly. Debugging revealed the following errors: 1) No relay set (used as window.postMessage targetOrigin), cannot send ...

Using React router to perform a redirection from within a stateless functional component

Hello, I am currently new to react and working on a project that involves user navigation across different pages. As part of this development, I have set up a TypeScript Project which includes the following files: App.tsx import React from 'reac ...

How can checkboxes be combined from two separate tables?

Within this interactive code example, you will find two tables containing checkboxes in each row. Upon clicking the To button, a dialog box will appear allowing you to select users or groups from a drop-down menu. The corresponding tables will then be dis ...

Anchor element not displaying Bootstrap popover upon focus trigger

I'm exploring ways to implement bootstrap popovers that respond to both click and hover events without relying on jQuery. I have a variety of controls on my page and I want to bind popovers to them using JavaScript. While testing with buttons and anc ...

What is the method for determining the active configuration?

I am working with a MongoDB database that consists of 3 collections. Each collection is exemplified below by a document: tag _id: ObjectId('61b873ec6d075801f7a97e18') name: 'TestTag' category: 'A' computer _id: ObjectId(&apo ...

Unable to retrieve rxjs resource

After upgrading to rxjs 5.4.3, I encountered an error in the browser. Despite having "rxjs": "5.4.3" installed in my package.json, I cannot seem to resolve this error message. Here's the content of my ts file: import { Injectable ...

The start-min/start-max parameters in the Google Calendar API are not providing accurate results

My aim is to query the Google Calendar API for dates falling between the specified start-min and start-max dates. However, the results I'm getting include dates from outside this range that shouldn't be included. The calendar I am accessing has n ...

Store the injected HTML within a PRE tag as a variable

My question pertains to a DIV HTML element that is responsible for displaying some HTML content from a variable: <div contenteditable="true" ng-bind-html="renderHtml(currentOperation.description)" ng-model='currentOperation.description&a ...

Having trouble accessing Blockly methods in index.html, despite functioning properly in other .js files where the workspace is displayed

Currently, I'm in the process of developing a unique tool that allows users to create HTML pages using Blockly blocks. Despite successfully setting up a workspace with my custom block, I am encountering issues when attempting to extract code from the ...

The error message "Cannot read property 'camera' of undefined" appeared when trying to access '_this.camera'

I'm attempting to display the camera feed from the front-facing camera within a <View> component, but I keep encountering this persistent error. Despite trying to reinstall react-native-camera and utilizing expo-camera, I am running out of solut ...

How can JavaScript be used to dynamically display submitted HTML form values on the same page, as well as how to perform calculations on the form data?

Currently, I am working on creating a form for collecting passenger information at an airport. The form includes fields for first name, last name, passenger weight, and cargo weight. Upon submitting the form, I aim to display the entered information along ...

Execute multiple JavaScript files dynamically by utilizing the same npm run command

My directory structure: app Model user.js post.js Contents of my package.json file: "scripts": { "migrate": "node ./app/Model/" } I am looking to execute JavaScript files via command line in a dynamic manner. For example: npm run migr ...

Having trouble loading HTML content from another file

Here is the code snippet in question: <script> var load = function load_home(){ document.getElementById("content").innerHTML='<object type="type/html" data="/linker/templates/button.html" ></object>'; } </script> ...

Sending data in chunks using Vue.js

I'm interested in sending the data in chunks. Currently, what I send to the server looks like this: for loop - 1, 2, 3. However, the server receives it asynchronously as 3, 1, 2 and I need it to be received synchronously in the order of my for loop: 1 ...

Unable to access request body data from API - value not defined

It's been a couple of hours and I'm still stuck on this issue >.< I'm having trouble accessing the request body for the user API. While I can retrieve the response 'hi' using res.send (as shown in the screenshot), I'm n ...