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
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. For example: I'm always frustrated when [...]
I'm looking to port my existing web app from ExpressJS/Pug to SvelteKit, and it would be really helpful if I can use the Pug preprocessor to save us a lot of time, i.e. we could just copy the code over to our new Svelte files without having to rewrite everything to Svelte all at once. The issue preventing me from doing this is that we pass a lot of variables and functions into our Pug files, such as i18n code (e.g. div!=msg('index.hello') becomes <div>Hello world!</div>) and variables from the database. It seems like the Svelte code transformer doesn't pass any locales into the compiled Pug function, so I don't see a way to pass our i18n msg function into there.
Describe the solution you'd like
I would really like it if I can pass data into the template function. Maybe like this:
Describe alternatives you've considered
For if / each statements, I imagine I could end the and do some Svelte if/each statements in between tags, but I don't think a solution like that could help with functions.
How important is this feature to you?
Vital. This would save an insane amount of time if I can pass locals to our Pug templates, because then we could keep the majority of our existing Pug code to start with, and then slooowly chip away at translating pages properly from Pug to Svelte, one at a time as-needed.
Additional context
If one of y'all can say that it's possible, but don't have the time yet to actually implement it, please let me know because I'd be willing to try and commit a contribution to implement this feature. But I'd rather not spend 5 hours poking through code and trying then to learn that it's not possible (it'd be easier to have a dev who knows how the preprocessing works who can probably say pretty easily if this is someting that's not possible.)
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. For example: I'm always frustrated when [...]
I'm looking to port my existing web app from ExpressJS/Pug to SvelteKit, and it would be really helpful if I can use the Pug preprocessor to save us a lot of time, i.e. we could just copy the code over to our new Svelte files without having to rewrite everything to Svelte all at once. The issue preventing me from doing this is that we pass a lot of variables and functions into our Pug files, such as i18n code (e.g.
div!=msg('index.hello')
becomes<div>Hello world!</div>
) and variables from the database. It seems like the Svelte code transformer doesn't pass any locales into the compiled Pug function, so I don't see a way to pass our i18nmsg
function into there.Describe the solution you'd like
I would really like it if I can pass data into the template function. Maybe like this:
Describe alternatives you've considered
For if / each statements, I imagine I could end the and do some Svelte if/each statements in between tags, but I don't think a solution like that could help with functions.
How important is this feature to you?
Vital. This would save an insane amount of time if I can pass locals to our Pug templates, because then we could keep the majority of our existing Pug code to start with, and then slooowly chip away at translating pages properly from Pug to Svelte, one at a time as-needed.
Additional context
If one of y'all can say that it's possible, but don't have the time yet to actually implement it, please let me know because I'd be willing to try and commit a contribution to implement this feature. But I'd rather not spend 5 hours poking through code and trying then to learn that it's not possible (it'd be easier to have a dev who knows how the preprocessing works who can probably say pretty easily if this is someting that's not possible.)
The text was updated successfully, but these errors were encountered: