Node-sass: How to exclude a specific folder using CLI

Created on 24 Oct 2016  Â·  9Comments  Â·  Source: sass/node-sass

Hi, my project has the following structure:

/app
/app/folderA
/app/folderB
/app/node_modules

I'm trying to use this command to compile my SCSS files under folderA and folderB.
node-sass --recursive 'app' --output 'build/app', however this will also compile the SCSS files in node_modules. Is there an option that I can use to exclude node_modules folder in this case?

I've tried this, node-sass --recursive ['app/folderA', 'app/folderB'] --output 'build/app', which doesn't work, giving the error No input file was found.

Module - CLI

Most helpful comment

Folders cannot be excluded with the cli

Yes... any chance of re-opening this issue in the light of these use-cases?

Having the output folder in the watched directory is very common for Visual Studio projects.

All 9 comments

No this is not possible with the CLI.

I recommend calling calling node-sass CLI once per directory.

@xzyfer I think this feature would be really good. Some people (like me) in small projects puts every .scss file into the root, the problem happens when node_modules folder is there; node-sass will try to compile some .scss files inside the folder and that's bad. 😢

Hear hear. Excludes for the win.

I've run into a related problem. My output directory is a sub-directory of the watched directory, e.g.

/app
/app/folderA
/app/folderB
/app/node_modules
/app/output  <----output directory

When the /app directory is watched recursively, every changed .scss file results in 2 output files. First /app/folderA/file.scss is output to /app/output/folderA/file.css; this in turn triggers a second compilation and I get another output file at /app/output/output/folderA/file.css.

While this may be a bug in itself (also not sure why .css files are being watched), if I can exclude /app/output from being watched, then that would solve the problem.

Furthermore, in our case the build process tries to remove the output directory and if it is being watched, I'm getting access denied errors.

Folders cannot be excluded with the cli. The output folder cannot be inside
the input folder.

On 18 May 2017 9:11 pm, "nabog" notifications@github.com wrote:

I've run into a related problem. My output directory is a sub-directory of
the watched directory, e.g.

/app
/app/folderA
/app/folderB
/app/node_modules
/app/output <----output directory

When the /app directory is watched recursively, every changed .scss file
results in 2 output files. First /app/folderA/file.scss is output to
/app/output/folderA/file.css; this in turn triggers a second compilation
and I get another output file at /app/output/output/folderA/file.css.

While this may be a bug in itself (also not sure why .css files are being
watched), if I can exclude /app/output from being watched, then that
would solve the problem.

Furthermore, in our case the build process tries to remove the output
directory and if it is being watched, I'm getting access denied errors.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/sass/node-sass/issues/1759#issuecomment-302513088,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjZWMUrDOQGU5B-XwOiWXuVB9ccw_Vcks5r7JfKgaJpZM4KfOCn
.

.CSS files can be imported with node-sass so they must be watched. This is
why this restriction exists.

On 18 May 2017 10:05 pm, "Michael Mifsud" xzyfer@gmail.com wrote:

Folders cannot be excluded with the cli. The output folder cannot be
inside the input folder.

On 18 May 2017 9:11 pm, "nabog" notifications@github.com wrote:

I've run into a related problem. My output directory is a sub-directory
of the watched directory, e.g.

/app
/app/folderA
/app/folderB
/app/node_modules
/app/output <----output directory

When the /app directory is watched recursively, every changed .scss file
results in 2 output files. First /app/folderA/file.scss is output to
/app/output/folderA/file.css; this in turn triggers a second compilation
and I get another output file at /app/output/output/folderA/file.css.

While this may be a bug in itself (also not sure why .css files are
being watched), if I can exclude /app/output from being watched, then
that would solve the problem.

Furthermore, in our case the build process tries to remove the output
directory and if it is being watched, I'm getting access denied errors.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/sass/node-sass/issues/1759#issuecomment-302513088,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjZWMUrDOQGU5B-XwOiWXuVB9ccw_Vcks5r7JfKgaJpZM4KfOCn
.

Folders cannot be excluded with the cli

Yes... any chance of re-opening this issue in the light of these use-cases?

Having the output folder in the watched directory is very common for Visual Studio projects.

It's really not possible without changing how @import works which cannot be
done. You can maybe try using includePath to include only the folder you
want watched, without a source folder.

On 18 May 2017 10:19 pm, "nabog" notifications@github.com wrote:

Folders cannot be excluded with the cli

Yes... any chance of re-opening this issue in the light of these use-cases?

Having the output folder in the watched directory is very common for
Visual Studio projects.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/sass/node-sass/issues/1759#issuecomment-302529732,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjZWNJyw62Yptg9Y7iNmOlTbdsOtH3Jks5r7KfggaJpZM4KfOCn
.

Was this page helpful?
0 / 5 - 0 ratings