For oswst@0.3.0.
template.js
var T = require('oswst');
with(T.with) {
module.exports = div()('<%= name? name : "undefined" %>')
}
gulpfile.js
var gulp = require('gulp');
var oswst = require('gulp-oswst');
gulp.task('templates', function() {
gulp.src('./template.js')
.pipe(oswst({
context: { name: 'OSWS' }
}))
.pipe(gulp.dest('./'));
});
<div>OSWS</div>
{ [name: string]: TContext };
Array;
(template: Function, options: TOptions, file: GulpFile, callback: (result: string) => void)
Handle any file.
template.js
var T = require('oswst');
with(T.with) {
module.exports = div()('<%= name? name : "undefined" %>')
}
gulpfile.js
var gulp = require('gulp');
var oswst = require('gulp-oswst');
gulp.task('templates', function() {
gulp.src('./template.js')
.pipe(oswst({
context: { name: 'OSWS' },
arguments: [1, 2, 3],
// default handler
handler: function(template, options, file, callback) {
Templates.Module(template)
.apply(null, options.arguments)
.render(callback, options.context);
}
}))
.pipe(gulp.dest('./'));
});