Grunt: create a zip file with the current date (AAAA-MM-DD)

I kept looking for a way to name the zip file with the current date using the plugin "grunt-contrib-compress". Is there any way to do this? I installed it correctly and installed the following:

compress: { build: { options: { archive: './zipped/foo.zip', mode: 'zip' }, files: [ { src: 'build/**'} ] } } 

I would like to have a zipped file named as the current date, instead of the custom name "foo":

 2014-09-25.zip 
+5
source share
1 answer

You can try using grunt.template.today() ...

  compress: { build: { options: { archive: './zipped/' + grunt.template.today('yyyy-mm-dd') + '.zip', mode: 'zip' }, files: [ { src: 'build/**'} ] } } 
+8
source

Source: https://habr.com/ru/post/1203372/


All Articles