sindresorhus / gulp-zip

ZIP compress files
MIT License
270 stars 47 forks source link

Request: Add more examples to documentation #122

Closed SamuelMiller closed 2 years ago

SamuelMiller commented 2 years ago

Hello, as a novice to Gulp, from the gulp-zip documentation I am not clear on how to use the options. Please provide examples in the documentation, particularly the modifiedTime option, which I assume adds a timestamp to the output file name.

sindresorhus commented 2 years ago

This is not the place to document Gulp conventions. See the Gulp docs on how to use Gulp.

sindresorhus commented 2 years ago

which I assume adds a timestamp to the output file

I'm not sure why you would assume that since the docs clearly says what it does:

Overrides the modification timestamp for all files added to the archive.

SamuelMiller commented 2 years ago

I am speaking about the documentation of your wonderful plugin. Keep in mind, that there are many novices like me who learn by examples.

These plugins, for example, provide a few examples of the various options. https://www.npmjs.com/package/gulp-useref or https://www.npmjs.com/package/gulp-htmlbuild

In the documentation of Gulp Zip, it states:

modifiedTime

Type: Date
Default: undefined

Overrides the modification timestamp for all files added to the archive.

Tip: Setting it to the same value across executions enables you to create stable archives that change only when the contents of their entries change, regardless of whether those entries were "touched" or regenerated.

What would be the format of the "date"?

For example, in my project, I have the following. (I've added a little datestamp JS snippet I found on the web to append the date on the file name. )

function zipProject() {
    return src(paths.zip.src)
        .pipe(zip(`samba_project_${(new Date().toJSON().slice(0, 10))}.zip`))
        .pipe(dest(paths.zip.dest));
};

How, would I define the "modifiedTime" option. Thanks.