I'm trying to add livereload to broccoli
Unfortunately the live-reload plugin documentation is a bit short and I cannot get it to work. In the docs it is stated to do the following:
var injectLivereload = require('broccoli-inject-livereload');
var public = injectLivereload('public');
I figured that this should be placed inside the Brocfile.js
(right?). But whatever I do nothing gets reloaded (I have to hit reload to refresh) I've also changed the 'public'
part, which I think is representing a directory. Any help would be appreciated.
I'm using BrowserSync instead of "only" LiveReload. It also supports LiveReload (and LiveInject for CSS), but it has tons of other features as well (like ghosting).
Let's create a file called
server.js
and a folder calledapp
next to it, where you put ourindex.html
,.css
and.js
. Thisserver.js
contains:Now fire the server (which will open the browser automatically):
I know this isn't as straightforward as Gulp or Grunt at first sight, but it offers fine grained control over everything and it's really blazing fast, even if your app grows and grows.
Instead of Livereload I opted to use Browsersync via the Broccoli Browser Sync plugin
My final
Brocfile.js
was very similar to (pulled from plugins npm page):With this solution I was able to continue using broccoli to serve my assets via
broccoli serve
and all my assets would be rebuilt then reloaded in the browser including my css.