Gulp convert directory of files and their contents to a JavaScript file -


i able setup gulp build system following: scan directory of files , store each file's contents value in javascript object.

for example, if have following directory structure:

templates/   a.html   b.html   c/     x.html 

the following javascript generated:

templates["a.html"] = "<contents of templates/a.html>"; templates["b.html"] = "<contents of templates/a.html>"; templates["c/x.html"] = "<contents of templates/c/x.html>"; 

does know of gulp plugin this?

may you: gulp-concat-util.

usage:

var concat = require('gulp-concat-util');  gulp.task('concat:dist', function() {   gulp.src('scripts/{,*/}*.js')     .pipe(concat('combined.js')     .pipe(concat.header('templates["<%= file.path %>"] ='))     .pipe(concat.footer(';\n'))     .pipe(gulp.dest('dist')); }); 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -