-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Deferred include (give names to includes or support variables in path) #282
Comments
Jade doesn't currently have a runtime or anything, it just compiles straight to js so there's no logic involved in includes etc, which are included at compile time |
What about...
This is at runtime... maybe one of the possibilities I gave could be simple to implement? |
the problem is that the includes need to take place at compile time, they combine ASTs, otherwise it's basically just an Express partial() |
So we can't use variable in include ? |
@GuriK nope, because it's compile-time |
That sucks :( |
we could eventually have something similar to partial() though we would have to cache a bunch of crap so it's not wasteful, and deal with the issues of options not cascading from the parent to the child properly such as the doctype etc, it's quite a bit more complicated, and at the end of the day it would basically be partial() |
I understand the issue of complexity, its just tough to choose jade when you can't do something simple like
Where
While this "works", it doesn't nest correctly. And likewise, you can't do something like this:
This means I have to write a ton of boilerplate code for each template. Sad panda. |
that would be pretty easy to do with a helper, basically just a few line cached readFileSync/jade.compile(). that being said the next release has template inheritance ready to go I just need to fix an error reporting bug |
Cool! I'm looking forward to the template inheritance. Is there a branch or ETA? |
it's in master actually, should be done pretty soon, the error reporting is pretty tough to get nice test coverage on so it's a bit of a PITA |
This issue has been inactive for over 2 months so I'm closing it. If you think it's still an issue re-open. - tjbot |
The issue seems old now, but has the functionality been added since then? |
Template inheritance is usually a much better solution to this problem. Since |
Too bad :( This is a really neat feature to include since it maintain our section of code very clean. So, several years later there is no plan to add this feature or a workaround not so complex like the above? |
lets get this in for the next version! #1990 |
Dynamic includes would be so awesome, I've run into issues twice this week on projects where they would solve them immediately |
I have an application with several templates, that have a base template. I then include each template (that corresponds to a view of the application). As Jade doesn't seem to support (I couldn't find), it would be great to have an include with a name like
or be able to use variables in the path like
Is this possible? Right now, I use a special string like "" and literally .replace() that with the sub template.
The text was updated successfully, but these errors were encountered: