bs-systemjs-hot-reloader
v1.0.6
Published
BrowserSync SystemJS / JSPM hot reload plugin with support of CSS, SCSS, SASS, LESS, Stylus, React and JavaScript
Downloads
6
Maintainers
Readme
BrowserSync SystemJS Hot Reloader
This plugin is compatible with hot reloader which is compatible with SystemJS v0.19.x only for now
Features
- BrowserSync plugin to watch file for changes and deliver events to SystemJS Hot Reloader
- JavaScript / CSS hot reload (if css plugin supports reload)
- Integrated CSS dependency tracker (SASS, SCSS, LESS, Stylus, CSS, PostCSS etc)
based on
progeny
library - Resolves JSPM and NPM virtual paths in CSS imports
- Designed to be used together with
BrowserSync
,JSPM
,SystemJS
andgithub:sormy/systemjs-hot-reloader
TODO
- Add tests
- Use ES2015+
- Reload assets
- Better default error handler
- Pass client side
systemjs-hot-reloader
options - Show BrowserSync notification on reload
Installation
npm install browser-sync bs-systemjs-hot-reloader --save-dev
jspm install npm:systemjs-hot-reloader-ex --dev
Usage
Please refer to systemjs-hot-reloader
usage to setup client side reloader.
This example will hot reload *.scss
and *.jsx
and will do full reload for
index.html
and jspm.config.js
.
var browserSync = require('browser-sync');
var bsSystemHotReloader = require('bs-systemjs-hot-reloader');
var bs = browserSync.create();
bs.watch([
'index.html',
'jspm.config.js'
]).on('change', bs.reload);
bs.use(bsSystemHotReloader, {
files: [
'src/**/*.scss',
'src/**/*.jsx',
]
});
bs.init({
server: '.',
online: false,
open: false,
reloadOnRestart: true
});
Options
resolver
-function (reloadFilename, sourceFilename) { return newFilename }
, not set by default. Custom resolver, which allow to send alternative filename to client side, for example, onsrc/module.js
change you could senddist/modules.js
to client side. If function returnstrue
orundefined
then original filename will be used. If function returnsfalse
then file change event will not be emitted to client. Otherwise file change event will be emitted with returned by function value.files
- standard BrowserSync plugin option to enable watch for changescssReloader
- css reloader options, passfalse
to disableloader
- instance of SystemJS, default toSystemJS
orSystem
jspmPrefix
- JSPM prefix RegExp which could be used in CSS files to refer relative to JSPM imports, default tojspm:
npmPrefix
- NPM prefix RegExp which could be used in CSS files to refer relative to NPM imports, default tonpm:
nodeModulesDir
-node_modules
path, default tonode_modules
supportsRegExp
- RegExp for supported filenames, default to/\.(scss|sass|less|styl|css)$/
handleAddEvent
- enable add event handling, default totrue
handleChangeEvent
- enable change event handling, default totrue
handleRemoveEvent
- enable remove event handling, default totrue
filterNoExport
- enable filter reloads (for_*.scss
), default totrue
reloadsFilter
- custom reloads filter function, default toundefined
rootPath
- project root folder (wherenode_modules
andjspm_packages
), default to current work directoryprogenyOptions
- progeny options, default to{}
jspmRootDir
- set JSPM root directory, default torootPath
jspmPackagesDir
- set path tojspm_packages
, default to./jspm_packages
jspmConfigFile
- set path to system/jspm config, default to./jspm.config.js
systemPath
- set path to SystemJS library, default to./jspm_packages/system.js
debug
- enable debug mode, default tofalse