0.1.0 • Published 5 years ago

gulp-velocityjs2 v0.1.0

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

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

0.1.0

5 years ago

0.0.12

5 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago