gulp-plates

v0.0.5
Uses flatiron plates to do DSL-free html templating
gulpplugin

gulp-plates

A gulp plugin for using flatiron plates for DSL-free templating.

var gulp = require('gulp'),
    plates = require('gulp-plates');

gulp.task('plates', function(){
  var context = { 'prefix': "123456" };

  // plates_config is an array of mappings to perform
  // each mapping is an array of operations with each
  // operation being an array with 2 values, an operation name
  // and an operation argument.
  var plates_config = [
    [ ['where', 'src'], 
      ['has', new RegExp('scripts\/.*')], 
      ['use', function(data, value, body){ return context.prefix + '/' + value; }], 
      ['as', 'src'] 
    ] 
  ];

  // For a simple binding, omit the plates_config argument.
  // Context properties will be mapped to tag ids
  gulp.src('index.html')
    .pipe(plates( context, plates_config ))
    .pipe(gulp.dest('build'));
});

License

MIT

npm i gulp-plates

Metadata

  • MIT
  • >=0.10
  • 007design
  • released 4/1/2014

Downloads

Maintainers