You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a vite template that supports conditionally adding certain plugins/dependencies. It would be nice if files could specify blocks to render based on a given variable:
Though it would be pretty nice to implement conditionals inside template files as well, I have a few reservations about this:
The current template syntax is pretty specific to avoid clashes with other syntax, this is not.
The current template mechanism is really intentional: it only changes variables read explicitly. This proposition is not (how to evaluate unread / empty variables?)
The current template evaluation mechanism is a single pass with extreme speed and simplicity (its a simple regex, basically). This requires a parse tree.
The current template evaluation mechanism can be safely repeated multiple times (for example, to read more variables). The suggested conditionals need to resolved on the first processing of the template.
Subsequently, I would like to try to come up with a solution that makes the conditional rendering a bit more convenient, but also keep the simplicity of the template engine. I suspect an "if" pipe would do something like that, though it would require further contemplation.
I'm trying to create a
vite
template that supports conditionally adding certain plugins/dependencies. It would be nice if files could specify blocks to render based on a given variable:tmplr.yml
vite.config.js
The text was updated successfully, but these errors were encountered: