Question

I want to create a file watcher that runs the (npm) gulp command when a file has changed. However, the issue is that I want to be able to commit this watcher to my repo, and have it work on both mac and windows.

The only way I have been able to make this work, is by using the explicit paths of %appdata%\roaming\npm\gulp.cmd and /usr/local/share/npm/bin/gulp. This would require 2 file watchers, with one being disabled on each platform.

Surely there must be a simpler way of executing a npm tool across the 2 platforms? E.g. for grunt, gulp etc.

Any help would be appreciated.

Thanks.

Was it helpful?

Solution

With some additional modifications/steps it should work (#2 may sound rather stupid, but that's how Windows works).

1) You will need to use Settings | Appearance & Behavior | Path variables and create the same named variable on all computers where this project will be used (it's IDE-wide settings so it's not stored as part of the project). Variable should point to a folder where gulp is located.

For example: http://youtrack.jetbrains.com/issue/WI-22610#comment=27-703614

2) On platforms other than Windows, you will have to create a symbolic link for gulp file -- it should be named gulp.cmd. This is needed as Windows recognizes executable file by it's extension so you have to point File Watcher to EXACT file name (in other words, just gulp on Windows will NOT work).

The above should do the job (sorry, Windows user here -- I do not have access to Mac or Linux to test it).

Related ticket: http://youtrack.jetbrains.com/issue/WEB-11534

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top