Socket
Book a DemoInstallSign in
Socket

metalsmith-dev-server

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-dev-server

Development server for Metalsmith

latest
Source
npmnpm
Version
0.2.0-0
Version published
Maintainers
1
Created
Source

metalsmith-dev-server

Development server for Metalsmith websites

metalsmith-dev-server is a simple, yet powerful tool to allow you to develop sites using the Metalsmith static site tool. Featuring:

  • Compatible with any Metalsmith project
  • Scroll syncing, network throttling, and more (via Browsersync)
  • Live reload of CSS changes

Usage

:package: Install — add this into your Metalsmith project.

npm install --save-dev github:rstacruz/metalsmith-dev-server

:pencil2: Create metalsmith.js — Your project should have a file that exports the Metalsmith project.

/*
 * Example metalsmith.js:
 * This builds the site when ran via `node metalsmith.js`.
 * When used as `require('./metalsmith')`, it returns the
 * app instance.
 */

const Metalsmith = require('metalsmith')

const app = Metalsmith(__dirname)
  .source('web')
  .destination('public')

if (module.parent) {
  module.exports = app
} else {
  app.build(err => { if (err) { console.error(err.message); process.exit(1) } })
}

:memo: Add scripts — Add this to package.json.

"scripts": {
  "dev": "metalsmith-dev-server metalsmith.js --watch web"
}

// This example runs the Metalsmith app in `metalsmith.js`,
// and auto-rebuilds when files in `web/` is changed.

:red_car: Start the server — Use your new script:

npm run dev

Or to specify another port:

npm run dev -- --port 3820

Also see

metalsmith-start is a more complex solution with other features, such as production mode.

Thanks

metalsmith-dev-server © 2017+, 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

 

Keywords

browser-sync

FAQs

Package last updated on 23 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts