This package has been deprecated

Author message:

this package has been deprecated

gulp-mustache-plus

1.0.1 • Public • Published

gulp-mustache-plus NPM version Build Status Dependency Status

mustache plugin for gulp

Forked from gulp-mustache to add some features.

Usage

First, install gulp-mustache-plus as a development dependency:

npm install --save-dev gulp-mustache-plus

Then, add it to your gulpfile.js:

var mustache = require("gulp-mustache-plus");
 
gulp.src("./templates/*.mustache")
    .pipe(mustache({
        msg: "Hello Gulp!"
    }))
    .pipe(gulp.dest("./dist"));

You may also pass in an object representing mustache partials and their contents as a third argument to the call to mustache() like so:

gulp.src("./templates/*.mustache")
    .pipe(mustache({
        msg: "Hello Gulp!",
        nested_value: "I am nested.",
        another_value: "1 2 3"
    },{},{
        some_inner_partial: "<p>{{nested_value}}</p>",
        another_partial: "<div>{{another_value}}</div>"
    })).pipe(gulp.dest("./dist"));

With gulp-mustach-plus, you also can use file in partials:

gulp.src("./templates/*.mustache")
    .pipe(mustache({
        msg: "Hello Gulp!",
        nested_value: "I am nested.",
        another_value: "1 2 3"
    },{},{
        some_inner_partial: "<p>{{nested_value}}</p>",
        another_partial: "<div>{{another_value}}</div>",
        file_1: "src/data/file_1",
        file_2: "src/data/file_2"
    })).pipe(gulp.dest("./dist"));

API

mustache(view, options, partials)

view

Type: hash or string Default: undefined

The view object, containing all template variables as keys. If you pass a string it will be used as the path to a JSON file containing view variables.

options

Type: hash Default: { extension: '.html' }

The options object to configure the plugin.

options.extension

Type: string Default: .html

options.file_prepend

Type: string Default: ``

Prepend each partial file with a string (e.g., useful to add \n before each file insertion).

partials

Type: hash Default: {}

An optional object of mustache partial strings. See mustache.js for details on partials in mustache.

License

MIT License

Package Sidebar

Install

npm i gulp-mustache-plus

Weekly Downloads

5

Version

1.0.1

License

none

Last publish

Collaborators

  • jbdemonte