@devcode/browser-sync v0.1.12
DevCode BrowserSync
DevCode plugin which serves for development purposes.
Getting started
Prerequisites
What things you need:
How to install
Install it as devDependency:
npm install -D @devcode/browser-sync
How to use
Include it in gulpfile.js
:
const gulp = require('gulp')
const plugins = {
browserSync: require('@devcode/browser-sync')
}
const env = process.argv.includes('build') ? 'production' : 'development'
const config = require('./config.js')
const watcher = plugins.browserSync(config, env)
gulp.task('watch', () => {
watcher()
})
If you use @devcode/init then you can use it like this:
const gulp = require('gulp')
const init = require('@devcode/init')
const plugins = {
browserSync: require('@devcode/browser-sync')
}
const env = process.argv.includes('build') ? 'production' : 'development'
init({
gulp,
env,
plugins: {
reload: [plugins.browserSync],
...
}
})
API
const pluginBrowserSync = require('@devcode/browser-sync')
// => function (config: object, env: string)
The required package returns function
which needs configuration (object
) and environment variable which accepts string
: development
or production
.
When you call this function it returns watcher
(function
) which you can call when you want to watch files changes.
Configuration
Options to pass to BrowserSync
module.exports = {
browserSync: {
// options related to the BrowserSync
}
}
Built with
- Gulp - The streaming build system
- BrowserSync - Live CSS Reload & Browser Syncing
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning.
Authors
- Matej Mazur - Initial work - GitHub account
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgements
- This project was inspired by Blendid