Dynamically Rendering with Node.js Emails is Slow
See original GitHub issueI 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:
app.get('*', async (req, res) => {
const template = await fsPromises.readFile(
path.join(basePath, 'src/templates', `${req.path}.html`),
)
const configPath = path.join(basePath, './config.production')
const {html} = await Maizzle.render(template.toString(), {
maizzle: require(configPath),
})
res.send(html)
})
…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?!
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
NodeJS + Template engine render slower comparing PHP
First of all, Jade is really slow, and may be slowest template engine (and that is not a secret). And the second problem...
Read more >Render dynamic content in Node.js using templates
In this article, we will see how we can render the front-end using Node.js which is very helpful to display static or dynamic...
Read more >Demystifying Server Side Rendering: Let's build our own SSR ...
Transmitting a lot of bytes in the form of JS code to your client (who are suffering from a slow connection); You're delaying...
Read more >Best practices to increase the speed for Next.js apps
Using server-side rendering will help your app reduce the time required ... To use dynamic import, you just need to import the code...
Read more >What is server-side rendering and how does it improve site ...
This is done by using a backend runtime such as Node.js that can run the JavaScript code to build the UI components. Here's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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. I also noticed the warnings: warn - You have enabled the JIT engine which is currently in preview. warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
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