Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
135 views
in Technique[技术] by (71.8m points)

How to convert directory SASS/SCSS to CSS via command line?

I tried:

sass-convert --from scss --to css --recursive app/assets/stylesheets temp

But this only converts css to SASS, and I want the other way around.

Then I looked at the sass command, but it doesn't look like I can pass it a directory.

question from:https://stackoverflow.com/questions/19439914/how-to-convert-directory-sass-scss-to-css-via-command-line

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To do a one-time Sass compile instead of a watch, you can do this from the command line:

sass --update scss:css

To have Sass import one file (usually a partial, with a _ starting the filename), you can do this inside a Sass file:

@import "_base.scss";

This way, Sass knows where you want the include to occur.

By default, Sass can't import an entire directory. The Sass Globbing gem, however, can. You can install it from the command line:

gem install sass-globbing

And then watch with it:

sass -r sass-globbing --watch sass_dir:css_dir

Note that globbing will import files alphabetically, so be sure your CSS will cascade appropriately if this occurs.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...