Menu

#2296 `--watch` does not handle new files while running

open
nobody
None
2018-04-03
2018-03-19
Anonymous
No

Originally created by: francoismassart

I have several npm scripts defined inside my package.json:
"css-compile": "node-sass public/static/scss/ -o public/static/css --recursive --output-style expanded --include-path ./node_modules/private-scss/ --include-path ../../ --precision 6",
...
"css-watch": "npm run css-compile -- --watch",

npm run css-watch is fast and works fine but if I add a new file demo.scss inside the watched folder public/static/scss/, the new file demo.scss never gets compiled, even after several saves and changes...

If I restart the watch, and then save again my new scss file, it compiled.

Is this normal ?

Thank you

  • NPM version 2.15.11
  • Node version v4.7.0
  • Node Process:

    { http_parser: '2.7.0',
    node: '4.7.0',
    v8: '4.5.103.43',
    uv: '1.9.1',
    zlib: '1.2.8',
    ares: '1.10.1-DEV',
    icu: '56.1',
    modules: '46',
    openssl: '1.0.2j' }
    - Node Platform: darwin
    - Node architecture: x64
    - node-sass version:

    node-sass 4.7.2 (Wrapper) [JavaScript]
    libsass 3.5.0.beta.2 (Sass Compiler) [C/C++]
    - npm node-sass versions: └── node-sass@4.7.2

Related

Tickets: #2305

Discussion

  • Anonymous

    Anonymous - 2018-03-20

    Originally posted by: francoismassart

    It is pretty much like the watch is applied to the existing scss files in the directory rather than to the folder and its (to be created) files...

     
  • Anonymous

    Anonymous - 2018-03-23

    Originally posted by: francoismassart

    I could use another watcher utility like nodemon in order to trigger a compile script but it would re-compile all the scss files instead of just compiling the files affected by the latest save operation.

    The watch option from node-sass works great for re-compiling only the affected files but how to make it take into account new files ? compass' watch did it right (slooow but right)!

     
  • Anonymous

    Anonymous - 2018-03-23

    Originally posted by: francoismassart

    I believe the issue comes from the fact that you use gaze by providing a list of files instead of a glob pattern. I guess this offers better performances but does not "watch" for new files outside of the list generated when the script is started.

    Maybe one solution would be to start a second instance of gaze when watching on entire directory.
    This second instance would only report new files added and pass them to our own watcher which would add it to the "non glob" list of the first gaze instance...

    BTW I updated to node-sass v4.8.1 but I still get an error while watching and deleting a scss file.

     
  • Anonymous

    Anonymous - 2018-03-30

    Originally posted by: davismj

    Also have seen this in 4.8.3.

     
  • Anonymous

    Anonymous - 2018-04-03

    Originally posted by: francoismassart

    In order to fix this issue prior to the release of v5, I did use chokibar to watch my scss folder and trigger the "entire" compilation of my scss files...

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.