0.0.11 • Published 9 years ago

gulp-osws-templates v0.0.11

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

OSWS Templates gulp plugin 0.0.11

gulp-osws-templates

GitHub version npm version Build Status

For osws-templates@0.2.5.

Usage

template.js

var Templates = require('osws-templates');

with(Templates.with) {
    module.exports = div()('<%= name? name : "undefined" %>')
}

gulpfile.js

var gulp = require('gulp');
var templates = require('gulp-osws-templates');

gulp.task('templates', function() {
    gulp.src('./template.js')
    .pipe(templates({
        context: { name: 'OSWS' }
    }))
    .pipe(gulp.dest('./'));
});
<div>OSWS</div>

Options

context

{ name: string: Templates.IContext };

arguments

Array;

handler

(template: Function, options: IOptions, file: GulpFile, callback: (result: string) => void)

Handle any file.

template.js

var Templates = require('osws-templates');

with(Templates.with) {
    module.exports = div()('<%= name? name : "undefined" %>')
}

gulpfile.js

var gulp = require('gulp');
var templates = require('gulp-osws-templates');

gulp.task('templates', function() {
    gulp.src('./template.js')
    .pipe(templates({
        context: { name: 'OSWS' },
        arguments: [1, 2, 3],
        
        // default handler
        handler: function(template, options, file, callback) {
    		Templates.Module(template)
    		.apply(null, options.arguments)
    		.render(options.context, function(result) {
    			callback(result);
    		})
        }
    }))
    .pipe(gulp.dest('./'));
});
0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.0.0

9 years ago