Skip to content

Instantly share code, notes, and snippets.

@bsparks
Last active June 13, 2016 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsparks/093ba0bec68828565f4961f8601a2233 to your computer and use it in GitHub Desktop.
Save bsparks/093ba0bec68828565f4961f8601a2233 to your computer and use it in GitHub Desktop.
experimenting with template literals
let wrapper = `
function tpl(scope) {
var T = function() {
Object.assign(this, scope);
this.get = () => \`
<%=contents%>
\`;
};
return new T().get();
}
export default tpl;
`;
gulp.task('templatize', function() {
return gulp.src('src/annotate-v1/templates/*.html')
.pipe(wrap(wrapper))
.pipe(rename({extname: '.tpl.js'}))
.pipe(gulp.dest('dist/'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment