Bones/node_modules/bs-recipes/recipes/server.includes/app.js
SOUTHERNCO\x2mjbyrn 7efe7605b8 Template Upload
2017-05-17 13:45:25 -04:00

25 lines
625 B
JavaScript

/**
* Require Browsersync
*/
var browserSync = require('browser-sync').create();
var fs = require('fs');
/**
* Run Browsersync with server config
*/
browserSync.init({
server: 'app',
files: ['app/*.html', 'app/css/*.css'],
rewriteRules: [
{
match: /@include\("(.+?)"\)/g,
fn: function (match, filename) {
if (fs.existsSync(filename)) {
return fs.readFileSync(filename);
} else {
return '<span style="color: red">'+filename+' could not be found</span>';
}
}
}
]
});