npmsassnode-sass

How to avoid subdirectory output in node-sass?


I have following setup under my project:

package.json has this command

"scripts": {
    "scss": "node-sass --watch assets/scss/styleguide.scss -o assets/css --recursive"
  }

When I run npm run scss it outputs subdirectory CSS files as well. Does anyone know how to avoid output of subdirectory sass files?

Thanks in advance!


Solution

  • You are passing the --recursive argument to node-sass. That will mean that node-sass will search recursively on every directory under assets/scss and will compile all the scss files found. To avoid that behavior just remove the --recursive option:

    "scripts": {
        "scss": "node-sass --watch assets/scss/styleguide.scss -o assets/css"
    }
    

    More about node-sass usages and options can be found here.