Slurp newlines from includes #88

wants to merge 1 commit into from

2 participants


I'm using ejs as part of a compilation process to concat some JS together and now, I'd like to use it to slurp in some templates as JS variables.

I'm not sure if this needs new syntax, or re-using the existing newline slurping syntax makes sense for includes. What I did felt like a bit of a hack, but it worked.

The idea is that with this you can do:

var foobar = '<% include foobar.tpl -%>';

and it'll slurp all the newlines from the included file.


Hmm, I already use the slurp on includes to fix the whitespace generated by the include line.

This would break that :/

Why not slurp everything in the include file?


Sure, perhaps some new syntax / filter support for includes makes sense then.

Slurping in the entire file, newlines and all, won't allow you to store it off in a variable, you'll end up with:

var foobar = '<div>
@inolen inolen closed this Dec 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment