-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Dynamically Rendering with Node.js Emails is Slow #430
Comments
For now I am using a slightly ugly workaround:
Will compile to
when running And in my Node.js I just do
|
Wow 18 seconds definitely doesn't sound right. Can you please let me know:
Ideally if you could provide a repo, even a private one, it'd be much easier for me to help. |
Also, check the gotchas, you should provide a Tailwind config and environment name if you want it to work as the |
For me it was caused by the latest version that comes with tailwind JIT (maybe it affects older versions too) if the |
Yeah, mentioned this here in #422 (comment). You need Try this for example, it should log a number <2000 (ms): // render-test.js
const Maizzle = require('@maizzle/framework')
const start = new Date()
Maizzle.render(
`your html`,
{
maizzle: {
env: 'production', // sets NODE_ENV = production
inlineCSS: {
enabled: true,
},
},
tailwind: {
css: '@tailwind utilities;',
config: require('./tailwind.config'),
}
}
)
.then(() => console.log(new Date() - start)) $ node render-test |
Yes, it works. |
@flolu does this solve your issue? |
@cossssmin I solved it like this: https://github.com/flolu/maizzle-node-example |
With the Maizzle version 3.6.1, env: 'production' and without purge or with but undefined or array and is rendering it in 5 sec which is less than 18sec but is still slow. |
If you use Tailwind's JIT, you need to specify the purge key. The warnings are coming from Tailwind, you can disable JIT if you prefer. |
can you use nodejs Maizzle.render function without mode jit? that would be great, all examples were using jit. maybe will be good to have a more detailed documentation and examples for render |
You can pass a Tailwind config object to the render function, inside of which you can disable JIT: |
without mode jit will be 23 sec. probably the 5 sec is the best performance for the render function but because is too long, the alternative solution of the render function from flolu seems to be the only solution as it will be under 1 sec |
I want to use Maizzle to dynamically render emails with Node.js.
For example to include the username in the content.
Is there a recommended approach to do this? Because my current implementation is very slow:
...rendering one email on my Kubernetes cluster takes 18 seconds.
I guess it's because TaildwindCSS needs to be compiled every time.
There must be a better way?!
The text was updated successfully, but these errors were encountered: