Bajix / broccoli-live-reload

Serve broccoli assets with watch rebuilding and live reload capabilities
ISC License
3 stars 0 forks source link

Broccoli Live Reload

Serve broccoli assets with watch rebuilding and live reload capabilities.

Tracks file diffs to prevent unnecessary reloading of the browser when unnecessary.

Not recommended for production use.

Version npmSupport via GratipayNPM DownloadsBuild StatusDependencies

Install

NPM

Documentation

LiveReload(options)

port {Number}

Optional. Default is 35729

path {String}

Optional. Default is 'assets'. This is the path that you're mounting broccoli live reload onto, and is used to normalize paths to match their respective urls.

Optional. If set, defines a set of patterns to match files against for tracking inclusion. This does not affect your build itself, and can be used to speed up tracking or to otherwise prevent changes from forcing reloads. For example, if you're using a css-preprocessor, you should omit your input files from tracking to prevent their changes from forcing reloads. This allows for live reload to hot-swap styling without refreshing the page, so long as the only tracked files that changed are CSS.

if (~process.argv.indexOf('--broccoli')) {
  app.use('/assets', require('broccoli-live-reload')({
    path: 'assets',
    include: [
      '**/*.js',
      '**/*.css' // We don't want SCSS/LESS to accidentally trigger a reload
    ]
  }));
} else {
  app.use('/assets', express.static('../public'));
}

Optional. If set, defines a set of patterns to match files against for tracking exclusion. This does not affect your build itself, and can be used to speed up tracking or to otherwise prevent changes from forcing reloads.

if (~process.argv.indexOf('--broccoli')) {
  app.use('/assets', require('broccoli-live-reload')({
    path: 'assets',
    exclude: [
      '**/*.swf', // Larger files are slower to track. This wouldn't matter unless your HD performance is slow, and there are many large files
      '**/*.png',
      '**/*.jpg'
    ]
  }));
} else {
  app.use('/assets', express.static('../public'));
}

Donations

Care to show your appreciation? Donations are much appreciated!