Compile multiple style sheets with Compass, a different output style, and a .min file name.

Summary. Using Compass, you need to compile SASS stylesheets twice with different output styles and file names.

I have it like my config.rb:

http_path = "/" css_dir = "assets/css" sass_dir = "assets/sass" # …more stuff… # output_style = :expanded 

which compiles fine

 assets β”— sass ┣ style1.scss β”— style2.scss 

to

 assets β”— css ┣ style1.css β”— style2.css 

What I need to do is:

 assets β”— css ┣ style1.css ┣ style1.min.css ┣ style2.css β”— style2.min.css 

where the .min.css files contain apparently reduced CSS.

So, I decided that I needed to come up with something like:

 on_stylesheet_saved do |filename| # switch output_style to :compressed # compile again and include ".min" into file name end 

Can someone provide me with a basic sample of how to do this? Until now, I have not cursed with ruby, but I come to a basic understanding through all the readings that I did on this topic .;) Thank you, heap!

+4
source share
2 answers

I suggest a Yeoman or custom Grunt script. You can also use Rake if you are more Ruby oriented.

+2
source

(I can not comment because of rep)

To answer Kevin Suttle, gulp might also do the job. It’s kind of like a grunt, but in gulp you get the configuration code, and grunt is basically a configuration and no (or almost none) code.

Many articles say that people learned to grunt during the day, while they only spent an hour learning gulp.

It is for you.

PS: Yes, this is a message from 2013, but an answer to it can help people who have the same or similar problem.

+2
source

Source: https://habr.com/ru/post/1493130/


All Articles