Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

How can I watch and compile multiple directories? #2894

Open
golddragon007 opened this issue Apr 20, 2020 · 4 comments
Open

How can I watch and compile multiple directories? #2894

golddragon007 opened this issue Apr 20, 2020 · 4 comments

Comments

@golddragon007
Copy link

Hello,

I really thought to leave grunt and use the native command line to be able to use the built-in --watch option. But I've faced some issue. I not really fount any documentation for the command-line way.
I have the following structure:
lib/module//sass/**
lib/theme/
/sass/**
In the sass directory in the root, there are the files which include other components from subdirectories. I want to watch every file but translate only without a starting '_' into CSS. (this is normal)
However, I want to place to their own directories CSS directory.
i.e.:
lib/module/first/sass/something.scss -> lib/module/first/css/something.css
lib/module/first/sass/something2.scss -> lib/module/first/css/something2.css
lib/module/second/sass/something.scss -> lib/module/second/css/something.css
lib/theme/my_theme/sass/style.scss -> lib/theme/my_theme/css/style.css

I don't want to use grunt or gulp for this, just pure command line, so I will be able to use the --watch option. Also, I don't want to use static mapping.
Can somebody help me how can I reach this? (If possible to do it.)

@saper
Copy link
Member

saper commented Apr 26, 2020

We provide only rudimentary watch facility (and it is not fully working even).

@golddragon007
Copy link
Author

Oh, I see. Then probably this is not the way how it will happen.

@Ismail-elkorchi
Copy link

If you are using npm, you can add a custom script to your package.json that runs the following script :

( node-sass lib/module/sass/ -o  lib/module/css/ --source-map true --output-style expanded -w ) & ( node-sass lib/theme/sass/ -o  lib/theme/css/ --source-map true --output-style expanded -w )

Note that this command will watch all the SASS files under lib/module/sass and lib/theme/sass and will output the resulting CSS files to lib/module/css and lib/theme/css.

@yameenyasin
Copy link

If you are using npm, you can add a custom script to your package.json that runs the following script :

( node-sass lib/module/sass/ -o  lib/module/css/ --source-map true --output-style expanded -w ) & ( node-sass lib/theme/sass/ -o  lib/theme/css/ --source-map true --output-style expanded -w )

Note that this command will watch all the SASS files under lib/module/sass and lib/theme/sass and will output the resulting CSS files to lib/module/css and lib/theme/css.

is there a way to do the same using node-sass.render api ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants