Search code examples
node.jssassphpstormnode-sass

PhpStorm seems to not allow scss file watching


I have a npm run watch job that uses node-scss to watch scss files and compile them into css files.

I use the PhpStorm IDE on Windows and when I make changes to an scss file, the file watcher (npm run watch) does not seem to recognise them. However if I open this same scss file in a Notepad, make changes, and save, the file watcher (npm run watch) recognises these changes and recompiles.

Does anyone know how to fix this issue so when I make changes to the scss file in PhpStorm the file watcher (npm run watch) will see them and recompile the css?


Solution

  • Please disable Use "safe write" option at Settings/Preferences | Appearance & Behavior | System Settings.

    • With this option enabled, IDE writes into temp file first, then deletes original file and only then renames temp into original name. Your npm run watch does not see this as file modification: it must see it differently.

    • When disabled IDE writes new file content directly into the file (like Notepad does) hence proper "file modified" signals getting received by your watcher.

    enter image description here