0

To make watch Twitter Bootstrap, are we supposed to use watchr for Node.js or gem watchr? This discussion suggested to use gem watchr.

I tried it with gem watchr, installed by (as instructed in https://github.com/mynyml/watchr):

  1. gem install watchr
  2. gem install rev
  3. gem install ruby-fsevent, as I was on Mac OS X 1.8.3

But, make watch didn't trigger make when there was a change in one of the LESS files.

$ make watch
echo "Watching less files..."; \
    watchr -e "watch('js/.*\.js') { system 'make' }"
Watching less files...
# ... nothing happened after this

Then, I also tried using Node.js watchr but no luck either. I verified that watchr is installed in my Node.js:

$ npm ls -g
...
└─┬ watchr@2.4.3
  ├─┬ bal-util@2.0.5
...

Help, please?

Community
  • 1
  • 1
moey
  • 10,587
  • 25
  • 68
  • 112

1 Answers1

0

I used the gem install of watcher, and had the same problem as you.

Assuming that you are using this on a Mac, then you need to also install rb-fsevent. Make sure that you install rb-fsevent and not ruby-fsevent, this latter one does not work well on, at least, OSX 10.8.

I also just re-read your question, and the second issue that you have is that you are not saying that you want to watch the less files, you are only saying that you want to watch the javascript files.

$ make watch
echo "Watching less files..."; \
    watchr -e "watch('js/.*\.js') { system 'make' }"
Watching less files...
# ... nothing happened after this

The important part here is that you have specified to watch('js/.*\.js'), which is only looking at your js/*.js files (using normal shell globbing), if you want to watch the files in your less directory, then you need to change it to:

$ make watch
echo "Watching less files..."; \
    watchr -e "watch('less/.*\.less') { system 'make' }"
Watching less files...
# ... nothing happened after this

And if you want to rebuild on both javascript or less file changes, then you need the following:

$ make watch
echo "Watching javascript and less files..."; \
    watchr -e "watch('less/.*\.less') { system 'make' }; watch('js/.*\.js') { system 'make' }"
Watching java files...
# ... nothing happened after this

If you want to see which files your watchr script is looking at, you can also do:

watchr -e "watch('less') { system 'make' }; watch('js') { system 'make' }" -l
Paul Wagland
  • 27,756
  • 10
  • 52
  • 74