WebStorm and Grunt Live Reload

webstorm-settings-generalI recently started using JetBrains’ Webstorm IDE at work, and was running into a really strange problem.

We use GruntJS as the build tool, with a Live Reload task as part of the build script. This allows us to make changes that will immediately be reloaded in the browser. The problem I was having was that my live-reload build task would error-out about every other or every third time. It wasn’t consistent, and was quite irritating. It seemed to be running the tasks twice, nearly on top of each other.

I finally seem to have figured out the problem. WebStorm has a feature called “Safe Write” that will write your changes to a temporary file first and, if that succeeds, it will then write the changes to the actual file you were working on.

Well, it seems that this feature was causing a second reload/build to occur, and these were conflicting, thus ending in an error. I turned this feature off, and have not had the same error yet! This was something that would happen nearly on every other reload, so to say that I am pleased is an understatement. 🙂

I still love WebStorm.

UPDATE: It seems I spoke too soon. It is still happening, but at a far less rate. Maybe this was part of the issue. Perhaps I’ll uncover the rest of the problem someday.