After upgrading from 4.5.3 the command below has stopped working. Changing the scss file does nothing:
"css": "./node_modules/.bin/node-sass -w scss/style.scss public/css/style.css"
Workaround
With the previous version the command works perfectly: npm install [email protected]
Using this command:
node-sass -w --output-style compressed -r ./scss --output ./public/css/
I get an error:
node/node_modules/node-sass/bin/node-sass:236
if (watch.indexOf(file) === -1) {
^
TypeError: watch.indexOf is not a function
When I took a look at the watch object it's structured like:
{ '/scss/':
[ '/scss/_includes.scss',
'/scss/_settings.scss',
'/scss/main.scss' ],
I removed the full path, but it's an object with key of directory path and an array of files in the directory. The if (watch.index) on *line 235 of node-sass/bin/node-sass isn't checking each of the keys in the object.... at least as far as I can tell.
Hope this helps.
Hey, this is just a simple fix. I've made a PR here: https://github.com/sass/node-sass/pull/2147
This is fixed in v4.6.1
I'm having what appears to be this same issue, in 4.6.1, when running the following. If I remove -w the file is output to my css folder, so I don't think I have a typo here. It seems that it isn't actually watching my _sass folder for changes.
"css-sass": "node-sass -w _sass --output css"
Not fixed. Same problem with node-sass -w input.scss output.css
npm install [email protected] works fine
@lucaseverett watch doesn't compile files till they are changed, don't use it as your compile script
Yes, I'm aware of that, but in this case watch isn't detecting changes.
Same behaviour - Windows 10 x64, node-sass 4.6.1
Reverting to 4.5.3 fixed the issue for me, am pinning on this version so I can keep moving.
We've just released 4.7.1 with additional fixes for the watcher
Most helpful comment
Workaround
With the previous version the command works perfectly:
npm install [email protected]