gulp-micro-templates

0.0.1 • Public • Published

gulp-micro-template

Build Status

Respecting micro-templating

why

spec

Make soruce files (.html)

<!-- ./tpl/foo.html -->
<a href="<%= url %>"><%= name %></a>
<!-- ./tpl/bar/baz.html -->
<% for ( var i = 0; i < users.length; i++ ) { %>
  <li><a href="<%=users[i].url%>"><%=users[i].name%></a></li>
<% } %>

to

this.MicroTemplates = {
    "tpl/foo.html": "<a href=\"<%= url %>\"><%= name %></a>",
    "tpl/bar/baz.html": "<% for ( var i = 0; i < users.length; i++ ) { %>
  <li><a href=\"<%=users[i].url%>\"><%=users[i].name%></a></li>
<% } %>"
};

usage

gulpfile.js

var microtemplate = require('gulp-micro-template');
gulp.task('microt',function(){
    gulp.src('./tpl/**/*.html')
    .pipe(microtemplate('all.js'))
    .pipe(gulp.dest('./build/tpl'));
});

Readme

Keywords

none

Package Sidebar

Install

npm i gulp-micro-templates

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • otiai10