我正在尝试使用 Grunt 和 grunt-contrib-cssmin 删除所有 CSS 注释,CSS 文件被编译并缩小它包含所有注释。
注释应与以下行一起删除:keepSpecialComments: 0
module.exports = function(grunt) {
require('jit-grunt')(grunt);
grunt.initConfig({
less: {
development: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
files: {
"css/main.css": "less/bootstrap.less" // destination file and source file
}
}
},
watch: {
styles: {
files: ['less/**/*.less'], // which files to watch
tasks: ['less'],
options: {
nospawn: true
}
},
},
cssmin: {
options: {
keepSpecialComments: 0
}
}
});
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default', ['less','cssmin', 'watch']);
};