pugjs / then-pug

**EXPERIMENTAL** Async promise based Jade
42 stars 5 forks source link

include and extends are blocking #16

Closed mikeyhew closed 9 years ago

mikeyhew commented 9 years ago

Here is a Gist that demonstrates that include'ing templates will result to calls to fs.readFileSync during parsing.

To change this behaviour would require modifying the Parser object, which right now is "require"d directly from jade. You would also have to change the API to make the compile function asynchronous.

I just re-read the Readme for this project, and realized that avoiding blocking filesystem calls may not be the goal of this project - if that's the case, I'd recommend making that more obvious on the Readme, ie: "then-jade does not make any changes to stage 1 of this process, and in fact still uses fs.readFileSync to read template files," or however you want to say it. (Hopefully your version will be more clear than mine - I'm not much of a writer.)

adamwong246 commented 9 years ago

+1

jeromew commented 9 years ago

async extends & include seem to be in the scope of jade 2+ ;

then-jade will not modify the compile step at this stage.

The Parser object is exported in the latest version of then-jade if you need to override it.

I'll add something to the readme so that it becomes clearer that only step2 becomes asynchronous.