-
Notifications
You must be signed in to change notification settings - Fork 844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a precompile step #743
Comments
This is possible in Eta, by calling |
@morandd Hi, this is possible for Eta (see eta-dev/eta#268 (comment)), but EJS here produces the following code: function anonymous(data) {
var include = function (path, includeData) {
var d = utils.shallowCopy(utils.createNullProtoObjWherePossible(), data);
if (includeData) {
d = utils.shallowCopy(d, includeData);
}
return includeFile(path, opts)(d);
};
return fn.apply(opts.context,
[data || utils.createNullProtoObjWherePossible(), escapeFn, include, rethrow]);
} This does not seem to me as something you can easily import and call, without at least knowing what |
What I did in Eta was
then save that to a file Regarding the EJS I haven't done this in EJS so I'll stop talking now. (I just happened to see this thread while looking at another EJS Issue.) Good luck! |
Hi, is it possible to add a precompilation step like handlebars'? Such that it's possible to compile .ejs files once to JS, and then render them with different data.
As far as I can see, that would be pretty similar to
ejs.compile
, except that instead of constructing a function to be executed on the fly, the source code would be returned so that it can be saved to disk.I don't mind submitting a PR if the idea is generally favored.
The text was updated successfully, but these errors were encountered: