-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Recursive watch flag has no effect on imported files #1731
Comments
Recursive flag is for watching directories. It doesn't make sense to As for watching imported files I think that may not work when watching a On 25 Sep 2016 6:06 PM, "Sergej Fröhlich" [email protected] wrote:
|
I thought, the recursive flag would exactly do that. Also watch imported files. If that is not the case, I suppose I don't need to keep looking. Is there a better option for my use case? Watching a single file and it's imports? |
There's no other option I'm aware. This is a bug in node sass. On 25 Sep 2016 7:00 PM, "Sergej Fröhlich" [email protected] wrote:
|
Can anyone shine a light on a best practice here? The preference is the same behavior as webpack with js files -- you have a single entry index.js and import all modules from there and webpack watches all imports... |
I switched to using a custom build file and a custom filewatcher, which then triggers node-sass. The preferred behaviour (and in my opinion the default) should however indeed be that one entry file and all its imports are watched by node-sass alone |
The expected behaviour of node-sass is what you're describing. This is a On 9 Oct 2016 6:10 PM, "Sergej Fröhlich" [email protected] wrote:
|
Sadly it's not working for me in the above mentioned setup. Don't know how many others this problem have and how replicable it is. |
I'm experiencing the same issue. This seems to be a bug of our watcher As a workaround we've put a chokidar instance in front of node-sass and this has worked out great us. Haven't had any issues with missed fs changes anymore! |
I just tested the This seems like the most sensible behavior and is what I expected as the default. However, these findings seem to contradict those of other people above. It's difficult to say what the cause of the problem is for those affected. However, based on my experience debugging issues related to file watchers in other projects, my suggestion is to update to the latest version of node (if possible) and reinstall all node_modules i.e. Finally, I want to point out that the phrasing of the description of the
As @xzyfer said above
Like @fr-ser, I took the description to mean that using |
@fvgs per this:
This is also the behavior I expect (and I presume many on this thread who are having similar problems). I will say that there appears to be a strange inconsistency to it. From my testing, here is something I noticed:
...now here's where it gets even weirder...
...because of the preexistence of I've tried deleting the project's |
As a team we're pressed for time. I personally am currently focused on shipping a major LibSass update. I'll outline some details for anyone keen to investigate and PR a fix. When the watch is started via the CLI when build an import graph. The graph tells up which files are imported by other files, and which files import them etc.. Using this graph, given a file, we can walk up the graph to find the top most files and compile them. For this to work we must watch all the files in the graph. When a file is changed we look the file's ancestors in the import graph. If an ancestor does not start with an _ we compile it. The bug is either in the watch logic, in sass-graph. |
wouldn't you want files that DO begin with an _ to cause a recompile of the ancestor? that's definitely the intuitive functionality i'm looking for that lead me to this thread. |
We watch for changes to files that begin with an _ (partials), but we don't compile them. We compile the files that imported them. Partials themselves are never compile targets in Sass. |
I ran into this issue and I was able to track down why descendent files were not being watched. The import regex in https://github.com/xzyfer/sass-graph/blob/master/parse-imports.js#L3 is looking for imports of the following format:
My imports originally were not in single or double quotes (e.g. This is something to watch out for if anyone else is running into the same issue. |
This change has caused the watched to become sluggish for us, sometimes taking a minute to trigger node-sass on changes. |
@mmase That's worrysome. Can you share your setup or better a sample repro where the problem is reproducable? |
Moved to #1869 |
Here it is how I do it in my console, works just fine: And use your import as: |
Fix error messages for `min` and `max`
Oddly enough the -r flag does not seem to make any difference on my system. I use the following command:
node-sass --watch development/style/main.sass production/bundle.css --recursive
This process builds my file just fine, but it ignores any changes done in imported files. The imports work however as the changes to the imported files are included once I change my main.sass again...
Any ideas why this is?
General information:
node-sass 3.10.0 (Wrapper) [JavaScript]
libsass 3.3.6 (Sass Compiler) [C/C++]
The text was updated successfully, but these errors were encountered: