0.0.11 • Published 10 years ago

gulp-osws-templates v0.0.11

Weekly downloads
1
License
MIT
Repository
github
Last release
10 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

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago