Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including paths from a file #52

Open
techie014 opened this issue Apr 27, 2018 · 5 comments
Open

Including paths from a file #52

techie014 opened this issue Apr 27, 2018 · 5 comments

Comments

@techie014
Copy link

This is a feature request. Including multiple paths in the script really becomes uncomfortable. For example:

"build-css": "node-sass-chokidar --include-path node_modules --include-path node_modules/foundation-sites/scss src/ -o src/"

This can longer and longer. It happens because some libraries import their dependencies using absolute path. For example: foundation-sites provides a _settings.scss file which can be imported if I want to override basic stuffs like color, width, height etc. However, in that file some dependencies are imported like parent/module. So it throws an error.

So, my request is to introduce a way to include paths from a file (ex. .chokidarrc) in the node-sass-chokidar processing. Thus multiple paths can be easily included in the file without any hassle.

Note: Please, feel free to suggest me alternatives.

@cigano
Copy link

cigano commented May 31, 2018

Having the same problem. I need to define one npm script entry for each SCSS file I need to compile, to avoid node-sass-chokidar to import also include files, like:

image

I have something like:

yarn run v1.7.0
$ node-sass-chokidar src/ -o src/
{
  "status": 1,
  "file": "D:/My/Folder/src/assets/stylesheets/bootstrap/custom/_typography.scss",
  "line": 3,
  "column": 17,
  "message": "Undefined variable: \"$spacer\".",
  "formatted": "Error: Undefined variable: \"$spacer\".\n        on line 3 of src/assets/stylesheets/bootstrap/custom/_typography.scss\n        from line 6 of src/assets/stylesheets/bootstrap/custom.scss\n>>   padding-left: $spacer;\n\n   ----------------^\n"
}
error Command failed with exit code 1.

By default, node-sass-chokidar reads all the directories recursively and tries to compile each file, regardless of being just an import from other file.

@oste
Copy link

oste commented Aug 14, 2018

Same issue here as well. I think it would be nice if it can support a wildcard like ./src/*.scss, that or add an option to make it non recursive.

@TDKRage
Copy link

TDKRage commented Sep 19, 2018

Trying to add import-glob-loader2 to it might help with the wild-card import.

@TDKRage
Copy link

TDKRage commented Sep 19, 2018

Trying to add import-glob-loader2 to it might help with the wild-card import.

UPDATE!: (Solution):

Used: https://www.npmjs.com/package/node-sass-glob-importer
updated my build-css to:

"build-css": "node-sass-chokidar --importer node_modules/node-sass-glob-importer/dist/cli.js --include-path ./src --include-path ./node_modules ./src/App.scss -o ./src",

Can now use:
@import "pages/**/*.scss";

in my scss files.

@joelruns
Copy link

joelruns commented Oct 8, 2018

I'm for even just making the CL statement shorter like
node-sass-chokidar -p=path_1/,path_2/,path_3/ ...
or something.

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

No branches or pull requests

5 participants