This is the sample gruntfile.js where the cssmin which is supposed ot minify .css to .min.css is not working.
module.exports = function (grunt) {
var buildDir = "build";
grunt.initConfig({
clean: {
},
cssmin: {
minify: {
expand: true,
cwd: "somePath/dataTables/css/",
src: ['*.css'],
dest: "somePath/dataTables/css/",
ext: '.min.css'
}
},
requirejs: {
compile: {
options: {
}
},
},
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('build', ['clean:build', 'cssmin', 'requirejs']);
grunt.registerTask('test', ['jshint', 'karma:default']);
}
I had added a reference in package.json as well.
I'm doing it that way and all the files are perfectly minified.
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
uglify : {
production : {
src : ['**/*.js', '**/*.*.js', '**/*.*.*.js', '**/*.*.*.*.js', '!*.min.js'],
cwd : 'development/js/',
dest : 'production/js/',
expand : true,
ext : '.main.min.js',
},
},
cssmin : {
minify : {
expand: true,
cwd : 'development/css/',
src : ['*.css', '!*.min.css'],
dest : 'production/css/',
ext : '.min.css'
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default', ['uglify', 'cssmin']);
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.