michaelwayman / node-sass-chokidar

A thin wrapper around node-sass to replicate the --watch using chokidar instead of Gaze
MIT License
291 stars 34 forks source link

Uknown variables and Mixins #59

Closed michalica closed 6 years ago

michalica commented 6 years ago

I am using create react app with SASS.

My file structure: -styles --variables.scss --mixins.scss --main.scss -v2-styles --stylesWhereAreMixnsAndVariablesUsed.scss -App.scss

App.scss: @import 'styles/main.scss'; // includes all .scss files from .styles/ folder // other styles from ./v2-styles

After updating node-sass-chokidar from 0.0.3 to 1.0.1 or higher I have issue when I run build-css "all variables and mixins are undefined" but watch-css works good.

"message": "Undefined variable: \"$text-color\".", "formatted": "Error: Undefined variable: \"$text-color\".\n

my scripts: "build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules -o src ./src/App.scss", "watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --src/App.scss src/App.css"

michaelwayman commented 6 years ago

You no longer need to run build-css in watch-css. perfects looking at the usages a little closer and you read the help pages and you mind find the issue.

michalica commented 6 years ago

I fix that issue by adding underscore prefix. I changed all scss files, except App.scss, from file.scss to _file.scss and errors were gone.