-
Notifications
You must be signed in to change notification settings - Fork 433
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
Expose the require definition to pug renderer #71
Comments
I'd be ok for it (others, any opinion ?). Exposing require should make it easy for users to extend the framework, but when you multiply the "require" it will make rendering slower (since it requires at every run). Out of curiosity what is your use-case ? I think I will also make yaml import easy. I like yaml. |
My current use case is:
The main benefit would be that you wouldn't have to store your data structures in the pug file, and pug would only contain rendering logic. |
This much is clear, the question was more what kind of data, how does it get rendered (table ? graph ?) what kind of document, is it for "interactive" use or use on a server, etc. I'm trying to get ideas of how it could get use, it can influence directions of the software. |
It doesn't have to be rendered in any specific way. The whole point is that users could keep their external data in a separate file, import the raw js/json file and render it. This would help keep your pug file clean of any data/variables. Another huge benefit of adding exposing the
|
Done. See this test example. Note that ReLaXed also exposes |
Looks good! Can you get a new build/version out on npm? |
possibly this evening |
Thanks! |
now in version 0.1.6 on npm |
Is it possible to import javascript (or json) files into
.pug
documents to use as content?Something like:
I believe that pug supports it (pugjs/pug#2604 (comment)) if you define
require
when passing in variables to pug.The text was updated successfully, but these errors were encountered: