2

I am wondering, how to batch compile SCSS files via windows command line...in the older version the command 'sass --watch scssFolder:CSSFolder' will do the job but it seems obsolete in the newest version of the SASS.

2 Answers 2

2

The methods you used for the sass node module are deprecated in the latest version, so you have two (and more) options:

Option 1: using node-sass

This is the option with less effort. You already have Node.js installed (and npm), so you can install the node-sass compiler running npm install -g node-sass. After all the install is complete, you will be able to watch or compile an entire folder (or a single file).

node-sass input.scss output.css will compile a single file.

node-sass input/folder -o output/folder will compile a entire folder.

With the -w option you can watch a folder:

node-sass -w input/folder -o output/folder will watch a folder and compile the files to theoutput folder.

Just run node-sass --help for a complete list of options.

Option 2: using Ruby SASS

You need to install Ruby and the install the Sass Gem by running the following command line gem install sass. After all the install is complete, you will be able to watch or update (compile) an entire folder (or a single file).

update will compile a single file or multiple files in a folder (depending on the parameters). watch will do the same and after the initial compilation is completed it will watch the file or all the files in the specified folder, so everytime a change is detected on any of the target files, sass will compile the changed ones.

Both options have the same command line sintax:

sass --watch input/folder:output/folder
sass --watch input.scss:output.css

So, to compile all the files in a folder:

sass --update path/to/input/folder:path/to/output/folder

And to compile and then watch a folder:

sass --watch path/to/input/folder:path/to/output/folder

Just run sass --help for a complete list of options.

Hope it helps!

Sign up to request clarification or add additional context in comments.

10 Comments

TNX @muecas for your reply.but as far as i understood, there is no command for batch compiling a folder in the newest version of the SASS or at least i haven't found yet.if there is plz let me know.
@ahmad I installed the latest version just to test this, and it worked. Ruby 2.5.1 and Gem Sass 3.5.6.
So let’s make things clear: if I want to do batch compiling, I do have to install Ruby on my machine anyway, otherwise it’s not possible to do batch compile a folder ... Am I right?!
You can’t even run sass without ruby! At least the version with the options you mentioned. You could run others versions, a version for node ja for example. Which version are you running?
I have used bower to install SASS... the SASS version i'm using is (1.3.0 compiled with dart2js 2.0.0-dev.50.0). nothing extra is installed on my machine and i'm just able to batch compile single files via windows command line...
|
0

sass watch is not implemented for the moment in the darts version, to compile your .scss files you can use

sass filename.scss filename.css

If you want you can still use the ruby version but it will be obsolete soon.

6 Comments

TNX for the reply.but as far as i know, the command you mentioned is just able to compile a single file and i am intent to compile the whole content of the scss folder of the bootstrap.
@ahmad oh sorry! Do you have try to replace the filename by the folder name ?
That won’t work. The proposed sintax is for single file compilation only.
@muecas ok, so ahmad you have to use the ruby version if you want to use sass --watch
There is no other sass command for window, just the one from the Ruby Gem.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.