Have ideas to improve npm?Join in the discussion! »

    This package has been deprecated

    Author message:

    Please update to a more recent version of metalsmith-in-place

    metalsmith-engine-jstransformer

    0.1.2 • Public • Published

    metalsmith-engine-jstransformer

    npm version build status coverage status greenkeeper downloads nsp status

    A jstransformer engine for metalsmith-in-place and metalsmith-layouts

    This engine allows you to render templates with jstransformer. Files will be transformed based on their extension, last extension first. Transformations are applied until there are no more applicable jstransformers left. Though its main purpose is rendering templates, any jstransformer compatible plugin can be used.

    Example

    For example, install jstransformer-handlebars to enable the handlebars transformation:

    $ npm install jstransformer-handlebars
    

    metalsmith-engine-jstransformer will detect which transformers you have installed and apply them. Use the following build configuration:

    var metalsmith = require('metalsmith')
    var inPlace = require('metalsmith-in-place')
     
    metalsmith(__dirname)
      .use(inPlace())
      .build(function(err){
        if (err) throw err;
      });

    Source file src/index.html.hbs:

    ---
    title: The title
    ---
    <p>{{title}}</p>

    Results in build/index.html:

    <p>The title</p>

    This is a simple example, but of course you can expand on this and use any jstransformers that you want to use. See metalsmith-in-place for instructions on how to pass options to jstransformer and see here to see which extensions match to which jstransformers.

    License

    MIT

    Keywords

    none

    Install

    npm i metalsmith-engine-jstransformer

    DownloadsWeekly Downloads

    84

    Version

    0.1.2

    License

    MIT

    Last publish

    Collaborators

    • avatar