Last active
June 13, 2016 23:52
-
-
Save bsparks/093ba0bec68828565f4961f8601a2233 to your computer and use it in GitHub Desktop.
experimenting with template literals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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