cssmin and timestamp replace
bauhau5 opened this issue · 2 comments
bauhau5 commented
Hey there. I'm trying to run two tasks simultaneously to output a minified css file with a timestamp when I run Grunt.
My Gruntfile looks like this but every time I run the code I get an error.
module.exports = function (grunt) {
//project configurations
grunt.initConfig({
cssmin: {
target: {
src: ["css/aw2018.css", ],
dest: "dist/aw2018.min.css"
}
}
replace: {
foo: {
options: {
variables: {
'timestamp': '<%= new Date().getTime() %>'
},
force: true
},
files: [{
expand: true,
cwd: 'css/',
src: ['*.css/*.js'],
dest: 'dist/',
ext: '.<%= new Date().getTime() %>.js'
}]
}
}
});
//load cssmin plugin
grunt.loadNpmTasks('grunt-contrib-cssmin');
//create default task
grunt.registerTask("default", ["cssmin"]);
grunt.registerTask('default', 'replace');
};
The error is Loading "Gruntfile.js" tasks...ERROR
SyntaxError: Unexpected identifier
Warning: Task "default" not found. Use --force to continue.
Any help would be appreciated.
halfnibble commented
You are re-registering the "default" task in your subsequent grunt.registerTask
call.
Multiple tasks are run like this:
grunt.registerTask('default', ['cssmin', 'replace']);
outaTiME commented
Thanks @halfnibble, it seems fixed.