grunt-contrib-cssmin

grunt-contrib-cssmin - how to remove comments from minified css

夙愿已清 提交于 2019-12-03 10:39:57
Im using cssmin to minify css files. my config like this: module.exports = function(grunt) { grunt.config.set('cssmin', { site: { src: ['.tmp/public/concat/site.css'], dest: '.tmp/public/min/site.min.css' } }); grunt.loadNpmTasks('grunt-contrib-cssmin'); }; But output minified css files has comments. Is it possible to configure cssmin to remove comment from source css files? Thank you. Set keepSpecialComments to zero, for removing all comments. grunt.config.set('cssmin', { options: { keepSpecialComments: 0 }, site: { src: ['.tmp/public/concat/site.css'], dest: '.tmp/public/min/site.min.css' }

cssmin not correctly handling @import

两盒软妹~` 提交于 2019-12-03 06:07:08
I am using cssmin on files containing @imports. cssmin is recursively importing local files correctly, but for imports that point to a URL the imports are left inline. This makes the resulting minified CSS invalid because @ rules must be at the beginning of the file. Does anyone know a good solution or workaround to this problem? Alex Carod I have exactly the same problem with cssmin and @import , and i found a solution with grunt concat : Create a concat grunt task that: Put @import url in the begining of mified css file and replaces references of @imports url for "". Execute task concat