0.2.0 • Published 5 years ago

gulp-freemarker-xmllein v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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