GithubHelp home page GithubHelp logo

jchtt / metalsmith-watch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fweinb/metalsmith-watch

0.0 2.0 0.0 60 KB

A metalsmith plugin to watch for a changes and trigger rebuilds.

License: MIT License

JavaScript 100.00%

metalsmith-watch's Introduction

metalsmith-watch Build Status NPM version

Metalsmith plugin to watch for changes and trigger partial and full rebuilds.

Installation

$ npm install metalsmith-watch

Usage

var metalsmith = require('metalsmith');
var watch = require('metalsmith-watch');

metalsmith(__dirname)
  .use(
    watch({
      paths: {
        "${source}/**/*": true,
        "templates/**/*": "**/*.md",
      },
      livereload: true,
    })
  )
  .build();

Options

paths (default: {"${source}/**/*": true})

Map of paths to trigger rebuild. Both keys and value accept a glob pattern.

{
  "file(s) to watch": "file(s) to rebuild"
}

Value accept a boolean. When a boolean is used, only watched files changed will be rebuilded.

{
  "${source}/**/*": true, // every changed files will trigger a rebuild of themselves
  "templates/**/*": "**/*", // every templates changed will trigger a rebuild of all files
}

Please note that:

  • ${source} is replaced by metalsmith.source().
  • values of the map are relative to metalsmith.source() (because it's the only place where to build files)

livereload (default: false)

Allows you to enable a livereload server. Using a boolean will enable a livereload server on port the default port is 35729. Accept a port number to start on the port you need.

To get live reload working properly, you should add the following <script> in your templates files to enable livereloading of each pages:

<script src="http://localhost:35729/livereload.js"></script>

Make sure to update the port number in the script above accordingly to the port specified.

log (default: function(...args) { console.log(prefix, ...args)})

Function used to display the logs.

invalidateCache (default: true)

Allows you to enable cache invalidation for js files. Convenient if you use some js files for templates (eg: React templates) to get updated components. If disabled you won't get update for changed js files as node/iojs use a cache.

metalsmith-watch's People

Contributors

almirfilho avatar derekerdmann avatar fweinb avatar jjclark1982 avatar jme783 avatar moox avatar obetomuniz avatar zakhenry avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.