Skip to content

mdvorscak/metalsmith-browser-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metalsmith-browser-sync

A Metalsmith plugin to make your workflow easier (using BrowserSync).

Build Status

Installation

$ npm install metalsmith-browser-sync

Example

Pass options to the BrowserSync plugin and pass it to Metalsmith with the use method:

var browserSync = require('metalsmith-browser-sync');

metalsmith.use(browserSync({
                    server : "myBuildDirectory",
                    files  : ["src/**/*.md", "templates/**/*.hbs"]
              }));

The default options are:

var defaultOpts = {
    server     : "build",
    files      : ["src/**/*.md", "templates/**/*.hbs"]
}

Options

You can pass any options you could normally pass to BrowserSync

Files

The files option represents the pattern option of BrowserSync.watch().

Callback

You can also pass a callback function, which is called when BrowserSync has completed all setup tasks and is ready to use. This is useful when you need to wait for information (for example: urls, port etc) or perform other tasks synchronously.

var browserSync = require('metalsmith-browser-sync');

metalsmith.use(browserSync({
                    server : "myBuildDirectory",
                    files  : ["src/**/*.md", "templates/**/*.hbs"]
              }, function (err, bs) {
                  // do some stuff here
              }));

License

MIT - view the full license here

About

A Metalsmith plugin to make your workflow easier.

Resources

License

Stars

Watchers

Forks

Packages

No packages published