How to Watch SASS files in all sub directories using npm script

33 views Asked by At

I would like to watch all sass directories and generate CSS files to the 'CSS' folder including sub directories. How can I achieve it. Presently I write all directories separately inside the NPM script as follows.

"scripts": {
    "sass": "sass --watch parent-directory/sass:parent-directory/css sub-directory/sass:sub-directory/css"
    }

This is not ideal when the project grows with more sub directories. Following is the structure and I am looking for a code which can compile from 'sass' folder to corresponding 'css' folder including sub directories.

 parent-directory:
 -sass 
 -css 
    sub-directory1:
    --sass 
    --css
      sub-directory2:
      --sass
      --css 

I used the following code. But it produces css files in the same 'sass' folder. I need to produce it to 'css' folder.

 "scripts": {
    "sass": "sass --watch ." 
  },
0

There are 0 answers