Skip to content

perguth/bs-conf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bs-conf

browser-sync does not expose all its options as command line arguments. bs-conf makes it possible to execute browser-sync from your package.json script section and still use all options by wrapping browser-sync and feeding it with a local configuration file.

Install

npm install bs-conf

Usage

Create bs-conf.js at the root of your project. Simply export a configuration object using browser-sync options like so:

// `bs-conf.js` example:
module.exports = {
  server: true,
  open: false,
  reloadOnRestart: true,
  files: [
    'index.html',
    'bndl/*'
  ],
  injectChanges: true,
  snippetOptions: {
    rule: {
      match: /\n$/i, // match last linebreak
      fn: function (snippet, match) {
        return snippet + match
      }
    }
  }
}

In your package.json you could now have an entry like

{
  ...
  "scripts": {
    ...
    "watch": "npm run bs-conf"
  }
}

and start it with npm run watch.

About

A wrapper of browser-sync that reads the configuration from bs-conf.js.

Resources

License

Stars

Watchers

Forks

Packages

No packages published