I am trying to minify an external css script using gruntjs and grunt-css plugin through the terminal.
The code I am running:
grunt --cssmin ../style.css > ../style1.css
Am I doing it right? Am I misunderstanding what Grunt is used for?
Thanks!
Here is what my generated style1.css looks like… It’s not minified.. I’m not sure what it is but it is doing something.
[31m<[39m[33mWARN[39m[31m>[39m [33mTask "cssmin" not found. Use --force to continue.[39m [31m</[39m[33mWARN[39m[31m>[39m
[31mAborted due to warnings.[39m
That is not exactly how Grunt works. Grunt uses a grunt file (
grunt.jsin v0.3 andGruntfile.jsin v0.4) to configure build instructions. First create a grunt file,grunt init:gruntfileand specify your css min targets there. I recommend reading the getting started guide in the Grunt docs:https://github.com/gruntjs/grunt/wiki/Getting-started
You can use Sqwish (what grunt-css uses) directly to do the above. Install sqwish globally with
npm install -g sqwishthen type:sqwish -o ../style1.css ../style.css. Read more about Sqwish here: https://github.com/ded/sqwish