I'm unable to properly configure cssmin. In this specific case I'm trying to confiure cssmin in order to create 2 different css minified file starting from two different css file. Using grunt --verbose on terminal I get:
Running "cssmin:foo" (cssmin) task
Verifying property cssmin.foo exists in config...OK
File: [no files]
>> No files created.
Running "cssmin:bar" (cssmin) task
Verifying property cssmin.bar exists in config...OK
File: [no files]
>> No files created
Here is the tree of the files:
- /Gruntfile.js
- /css/foo.css
- /css/bar.css
- /production/
Here is the configuration in Gruntfile.js
var config = {};
config.cssmin = {
foo: {
target: {
files: [{
expand: true,
cwd: 'production/productionext',
src: 'css/foo.css',
dest: 'production/productionext',
ext: '.min.css'
}]
}
},
bar: {
target: {
files: [{
expand: true,
cwd: 'production/productionmy',
src: 'css/bar.css',
dest: 'production/productionmy',
ext: '.min.css'
}]
}
};
grunt.initConfig(config);
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default', [
'cssmin:foo',
'cssmin:bar'
]);
The cwd property sets a current working directory which your src path will then be relative to. In your example it will be looking for your first source file at 'production/productionmy/css/foo.css'.
Also you don't need the "target" bit inside foo and bar, foo and bar are the targets, so it should look like this:
If you want to rename the file as part of the minification process use the following syntax: