Open Jeff-Tian opened 8 years ago
It will "work" out of the box. Unfortunately though, the EJS won't have access to any runtime variables, so it's not actually very useful with templating languages like EJS.
The way this currently works is that the "filter" which is an npm module with the name "jstransformer-
There are two things that people generally want that I would call "runtime filters":
I think the steps to allow filters to return JavaScript rather than HTML working would be:
:
do we define say ?
(which we don't currently use) to mean "runtime" and then support ?:filter-name
to mean "runtime filter"filter
method for runtime-filter
)parseFilter
and parseIncludeFilter
for runtime-filter
)compileClient
method and generate a pug AST token of type Code
instead of Text
(see https://github.com/pugjs/pug-ast-spec/blob/master/parser.md#code)All of this could be done via a plugin, but it's a fair bit of work.
I saw the grammer
include:markdown xxx.md
to include markdown files, it's very sexy!I have a lot of existing
ejs
template files, and I want to include some to mypug
template. How can I write a little code to makeinclude:ejs xxx.ejs
work?Thanks!