gulp-freemarker-xmllein

0.2.0 • Public • Published

gulp-freemarker-xmllein

NPM version Build Status Coverage Status Dependency Status

  • (只修改了按需编译,不是每次都全局编译)freemarker plugin for gulp
  • 注意:在修改include 进来的公共文件不会编译,所以只能修改非公共页面来达到公共文件修改查看(有点绕口)

Usage

First, install gulp-freemarker-xmllein as a development dependency:

npm install --save-dev gulp-freemarker-xmllein

Then, add it to your gulpfile.js:

var freemarker = require("gulp-freemarker-xmllein");
 
gulp.src("./mock/*.json")
    .pipe(freemarker({
        viewRoot: "WEB-INF/views/",
        options: {}
    }))
    .pipe(gulp.dest("./www"));

You should provide mock files, which type is json:

{
    "file": "hello.ftl",
    "data": {
        "name": "World"
    }
}
  • file is relative to viewRoot, gulp-freemarker-xmllein will read and process ${viewRoot}/${file} file.

  • data is the data model the template required.

API

freemarker(options)

options.viewRoot

Type: String Required: true

The directory where all templates files in.

options.options

Type: Object Default: {}

Options for Freemarker.js. see also https://github.com/ijse/freemarker.js#configurations.

License

MIT License

/gulp-freemarker-xmllein/

    Package Sidebar

    Install

    npm i gulp-freemarker-xmllein

    Weekly Downloads

    3

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    28.4 kB

    Total Files

    19

    Last publish

    Collaborators

    • xmllein