Skip to content

Instantly share code, notes, and snippets.

@kcmr
Created August 6, 2017 00:08
Show Gist options
  • Save kcmr/dd96a719d549f6976f952ab3e1e0be91 to your computer and use it in GitHub Desktop.
Save kcmr/dd96a719d549f6976f952ab3e1e0be91 to your computer and use it in GitHub Desktop.
Browser Sync for a Polymer Web Component
const bs = require('browser-sync').create();
const componentPath = `/components/${__dirname.split('/').pop()}`;
bs.init({
files: [ '**/*.{html,js,css}' ],
open: false,
ghostMode: false,
startPath: `${componentPath}/demo/index.html`,
serveStatic: [{
route: componentPath,
dir: '.'
}, {
route: '/components',
dir: 'bower_components'
}],
server: {
baseDir: '.',
routes: {
componentPath: '.',
'/components': 'bower_components'
}
}
});
{
"name": "new-component",
"license": "MIT",
"scripts": {
"serve": "node browsersync.conf"
},
"devDependencies": {
"browser-sync": "^2.18.13"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment