-
-
Save FiNGAHOLiC/2566471 to your computer and use it in GitHub Desktop.
grunt cssmin sqwish task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* cssmin tasks | |
* sqwish: https://github.com/ded/sqwish | |
*/ | |
module.exports = function(grunt){ | |
var log = grunt.log; | |
var sqwish = require('sqwish'); | |
grunt.registerMultiTask('cssmin', 'minify css by sqwish', function() { | |
var dest = this.data.dest; | |
try { | |
var css = grunt.file.read(this.data.src); | |
var minified = sqwish.minify(css); | |
grunt.file.write(dest, minified); | |
} catch(e) { | |
log.writeln(e.message); | |
grunt.helper('growl', 'SQWISH GOT ERROR', e.message); | |
return false; | |
} | |
return true; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found it better to use this.file instead of this.data as file has any variables expanded (like meta.version or pkg.name or whatever). See my fork.