简体   繁体   中英

Yeoman: Add sass/compass support in grunt to existing project

I have an existing project, but I need to add sass/compass so that grunt will automatically compile it when I use the grunt server command.

Does anyone know how I do this?

Edit: I've managed to add grunt sas/compasss to the project, but I need to configure gruntfile.js to watch and compile the css. All I've done to add sass support is to run npm install grunt-contrib-sass --save-dev .

I've made a gist of a Gruntfile.js I'm using for a project that does SASS compilation and a handfull of other things.

It's inspired of Yeoman's webapp generated Gruntfile.js , with BlessCSS and Assemble, Htmlmin configured to run smoothly with Usemin and Coffee/Mocha stuff commented out.

Basically, what you need to do is config the SASS task and then add it to the watch task, and setup livereload to watch your CSS files.


Edit:

Since I was using this Gruntfile and these grunt tasks pretty often, I've since made a yeoman generator that you can checkout here : pj/generator-yawa

It does sass/compass among other things.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM