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.
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.
Use the
sass
command followed by theinput file name and path
, a colon (:
) and the desiredoutput file name and path
. If the output file does not already exist Sass will generate it. For example,However, this is a one-off command that would require being run every time you want to generate a new CSS file. A simpler and handier method is to use Sass's built-in
--watch
flag. This watches for changes to your Sass file and automatically runs the compile command each time you save changes.If you have multiple Sass files within a directory you can watch for changes to any file within that directory:
Sass also has four CSS output styles available:
nested
,expanded
,compact
andcompressed
. These can be used thus:Refer to the Sass documentation for more.
To do a one-time Sass compile instead of a
watch
, you can do this from the command line:To have Sass import one file (usually a partial, with a
_
starting the filename), you can do this inside a Sass file: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:
And then watch with it:
Note that globbing will import files alphabetically, so be sure your CSS will cascade appropriately if this occurs.
You can use
compass
to convert Sass files into CSS.To initialize the
config.rb
, try:Once you've the configuration file, try:
or by specifying the file explicitly:
compass compile sass/foo.scss
.To install it, try:
to that, simply go your project directory and do this :
with sass-dir the directory containing your actual sass files and assets/css the desired output directory.
Hope this could help.