gulp-velocityjs2

0.1.0 • Public • Published

gulp-velocityjs2

Gulp compile plugin for velocity(http://velocity.apache.org/) template.

npm npm

Install

yarn add gulp-velocityjs2

Usage

Basic

const gulp = require('gulp');
const gulpVTL = require('gulp-velocityjs2');

gulp.task('build', ()=>{
  return gulp.src('./index.vm')
    .pipe( gulpVTL() )
    .pipe(gulp.dest('./build'));
});

Variable

<div>hello $name</div>
gulp.task('build', ()=>{
  return gulp.src('./hello.vm')
    .pipe( gulpVTL({ name: 'byungi' }) )
    .pipe(gulp.dest('./build'));
});

output:

<div>hello byungi</div>

API

gulpVTL([data[, options]])

Returns gulp transformer for velocity compilation.

data

Set the data values.

object
gulp.src('index.vm')
    .pipe(gulpVTL({var1: 'value1', var2: 'value2'}))
file
gulp.src('index.vm')
    .pipe(gulpVTL('./data.json'))
directory

If it is a directory, set the data that matches the file name in the directory.

gulp.src('view/*.vm')
  .pipe( gulpVTL('data/') )

view/main.vm

hello $value

data/main.js

export.value = 'world'

output:

hello world

options

Compile options

details https://github.com/shepherdwind/velocity.js

  • escape
  • unescape
  • env
  • blocks
  • ignorespace
  • macros
Other options
ext

Output extension name. Default is html

refresh

If this value is true, import new data from the path without cache. This is useful when in watch mode. Default is false.

Related

License

MIT

Package Sidebar

Install

npm i gulp-velocityjs2

Weekly Downloads

10

Version

0.1.0

License

MIT

Unpacked Size

4.79 kB

Total Files

4

Last publish

Collaborators

  • skt-t1-byungi