I've been looking all over for a way to name a zip file with the current date, using the "grunt-contrib-compress" plugin. Is there a way to accomplish it? I properly installed it, and set as follow:
        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, in place of the custom name "foo":
2014-09-25.zip
You can try using grunt.template.today() ...
   compress: {
     build: {
        options: {
            archive: './zipped/' + grunt.template.today('yyyy-mm-dd') + '.zip',
            mode: 'zip'
        },
        files: [
            { src: 'build/**'}
        ]
     }
    }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With