How to pipe YAML into EJS in a Gulp stream? -


I am using I want to insert the resulting JSON data directly into the pipe. My argument says that I have to meet synchronous at some point of time?

How much I have tried this way:

  var yaml = require ('gulp-YAML'); Var ejs = is required ('gulp-ejs'); Gulp.task ('yaml', function) (return gulp.src ('. / Path / to / template.ejs') .pipe (ejs (gulp.src ('. / Path / to / data.yml'). Pip (yaml ()).) .pipe (gulp.dest ('. / Path / to / dest'));});  

I realize that the above is a stupid script because I am essentially trying to cross the stream in the form of the argument of ejs . And according to the prophecy, it does not work. I have tried many other things, but do I think someone has done this before?

I think that will have to do something with the solution ...

Probably this does not require the GLapp-Data plugin; Like you said that you are just going through synchronous options for EJS plugin, and you only need a yaml config file. So it's probably better:

  var yaml = require ('js-yaml'); Var ejs = is required ('gulp-ejs'); Var FS = Requirement ('FS'); Gulp.task ('ejs-with-yaml', function () {return gulp.src ('path / to / template.ejs'). Pipe (ejs (yml.safeLoad (fs.readFileSync (' path / to / data .yml ',' utf-8 '))) .pipe (gulp.dest (' path / to / dest ')););  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -