Détail du package

metalsmith-start

rstacruz693MIT2.0.1

Development server for Metalsmith.

jekyll, metalsmith, static

readme

metalsmith-start

Development server for metalsmith.

Status

  • Consumes the standard metalsmith.json.
  • Consumes metalsmith.js.
  • Auto-recompiles when files are changed.
  • Starts development server and LiveReload.


Command-line

Run metalsmith-start or metalstart in your Metalsmith's project directory.

metalsmith-start

See --help for more options.


Production

metalsmith-start honors the following variables:

  • NODE_ENV
  • PORT

If either NODE_ENV is set to production, then development features (such as LiveReload) will be disabled by default.

This means that you can run a production setup using:

env NODE_ENV=production PORT=4000 metalsmith-start

This also means you can push your repo to Heroku with no changes and it'll work just fine.


Using metalsmith.js

If a file called metalsmith.js is found in the current directory, it's assumed it's a JS module that returns a Metalsmith instance.

Below is a sample metalsmith.js:

var Metalsmith = require('metalsmith')

var app = Metalsmith(__dirname)
  .source('./src')
  .destination('./public')
  .use(...)

if (module.parent) {
  module.exports = app
} else {
  app.build(function (err) { if (err) throw err })
}


Superstatic

If superstatic.json is found in the current directory, it'll automatically be picked up. This allows you to, say, use cleanUrls to allow pages to be served without the .html extension.

See superstatic for more information.


Programatic usage

var Runner = require('metalsmith-start').Runner

var ms = new Metalsmith(dir)
  .use(...)
  .use(...)

var r = new Runner(ms)
r.start(function () {
  console.log('started on ' + r.port)
})


Thanks

metalsmith-start © 2015+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).

ricostacruz.com  ·  GitHub @rstacruz  ·  Twitter @rstacruz

changelog

v2.0.1

Jan 5, 2016

  • Fix "Can't modify headers" error messages.

v2.0.0

Jan 3, 2016

  • Update to superstatic v4.0.1. If you use superstatic.json, you will need to be update it; see superstatic 4.0.0 for info.
  • Shorten required console columns for wide mode
  • Internal: update get-port to v2.1.0
  • Internal: update to meow v3.5.0

v1.4.2

Oct 16, 2015

  • Fix last version by bulding connect

v1.4.1

Oct 16, 2015

  • Update superstatic to v3.0.0 (from 1.2.3)

v1.3.4

Oct 16, 2015

  • Fix jaggedness in status display

v1.3.3

Oct 16, 2015

v1.3.2

  • Oct 15, 2015

  • Oops, last version didn't work.

v1.3.1

Oct 15, 2015

v1.3.0

Oct 15, 2015

  • Updated look of the CLI reporter.

v1.2.0

Oct 9, 2015

  • Lock version dependencies; no functional changes.

v1.1.0

Oct 5, 2015

  • Add support for programatically running a Metalsmith instance.

v1.0.1

Sep 20, 2015

  • Improve logging format of plugin errors in metalsmith.json.

v1.0.0

Sep 20, 2015

  • Declared as v1.0.0 - no functional changes.

v0.6.1

Sep 20, 2015

  • Minor improvements to auto-compiling
  • Fix issue where writing .map files can refresh an entire page

v0.6.0

Sep 20, 2015

v0.5.0

Sep 20, 2015

  • Significantly improve LiveReloading functionality.
  • Don't log 'serve' messages anymore (wasn't really nedeed).

v0.4.0

Aug 14, 2015

  • Use NODE_ENV environment variable.
  • Disables watching and livereload on production.

v0.1.0

Aug 14, 2015

  • Initial release.