watching newly created files
Deimoslink opened this issue · 18 comments
Greetings!
When I start node-sass in recursive watching mode it works just fine with the exception that newly created files are not being watched.
For example, if I wach a directory and I add new styles.scss file, node-sass ignores this file, providing the process has already been started before.
Is it possible to change this behavior? Or do I just miss something?
I can also reproduce this on OS X Sierra with node-sass@4.5.0
.
My command looks like this:
node-sass src/ -o src/ --watch --recursive
Adding src/wow.scss
(and saving it multiple times) has no effect until I restart the watcher, at which point it works as intended for this file (but not for any new files).
I also tried removing the --recursive
flag but it doesn’t seem to have any effect.
Thanks for such a quick response!
👍
I wonder if you could possibly reconsider #1369 at the same time? I believe it would improve consistency across the board.
With #1369 implemented - all files are guaranteed to be in a compiled state whether they already existed or were created while watching.
Without it - files that already exist are not compiled. Files that are created while watching are compiled. This seems inconsistent and fiddly to manage.
Thanks for your consideration.
@xzyfer Hiya. Appreciate this fix! I cloned and cherry picked the commit to give it a test (and tried master
additionally) but while it now picks up .css
additions, it's still not picking up and compiling new .scss
files. This is on Mac OS X El Capitan. Any ideas?
I see, it seems only to be looking for files linked in from JavaScript. So in the case where we're including .css
but generating it via node-sass
from new .scss
files (created while the build process is already running), this wouldn't work.
Our use case on a creating a new file is to create a .scss
file, which we'd want automatically compiled to .css
without having to restart the build process. I suppose I could monkey patch the code to handle our specific case, but perhaps there is a more general approach.
@Deimoslink Per the comment above, are you still having the same issue?
@xzyfer Even more unfortunate, our existing .scss
files, when edited, are no longer compiled into .css
. So this is a wonderful fix if you're editing and using .css
directly, but if you're using .scss
compiled to .css
it has the same issue as before and introduces a regression.
TO BE CLEAR and I should have said this before, we're using create-react-app
and so if its configuration needs to change, we haven't yet done that.
This issue was closed but was not actually resolved. I'm running v4.9.4 on OSX 10.12.2 (Sierra) and the problem persists, exactly as described by @gaearon
node-sass-chokidar doesn't suffer from this issue, at least on my machine. From what I understand the only difference between the two is that nsc uses chokidar instead of Gaze to watch files, but I'm totally out of my depth here.
This issue was closed but was not actually resolved
Not resolved in july 2019 either (running Linux), but still 'Closed' on github unfortunately :(
I'm still having this problem, Oct 2019. Running Mac OS Mojave. Please think of reopen this
@mankinchi can you build a simple repository with a script to demonstrate this?
Same problem, January 2020.
Same problem, February 2020. Any solution?
Having exactly the same issue. Using latest node-sass 14.4.1 (July 2020) and Windows 8.1 machine. Still no solution?
Here is how my command looks like: node-sass sass/main.scss css/style.css -w --recursive
update: ended up installing node-sass-chokidar and now everything works as it should
Also having this exact issue. Thanks @t-kowalewski just swapped to node-sass-chokidar and it's now working fine!
Same here with Node 12.18.3 and node-sass 4.14.1
issue still exists :(
Node 21 and node-sass 9.0