Comments (7)
Hello,
Got exactly the same problems when rendering emails to send to different customers in AWS lambda
from heml.
I found a workaround.
I actually build with a script all my folder heml, into a folder html. Push both folders and in the code I directly load from the html folder (and for variables i use Mustache)
Script to build:
#!/bin/bash
type heml >/dev/null 2>&1 || { echo >&2 "Require heml. Please install (yarn global add heml)."; exit 1; }
for entry in "heml"/*
do
if [ -f "$entry" ];then
echo "-- Building $entry to html"
filename=${entry##*/}
heml build $entry --output html/${filename%.*}.html
fi
done
Load html email:
const htmlEmail = fs.readFileSync(`${__dirname}/../emails/templates/html/myemail.html`, {
encoding: 'utf-8',
});
Build the emails with dynamic variables:
const htmlEmailWithValues = Mustache.render(htmlEmail, emailData);
const form = new FormData();
form.append('from', 'App <[email protected]>');
form.append('to', `${firstname} <${email}>`);
form.append('subject', subject);
form.append('html', htmlEmailWithValues);
from heml.
@BenMansley @GemN or anyone find a solution to this? Same problem. It pretty much renders this project useless for service type activity :(
from heml.
I'm getting the same error.
Has anybody found a solution or a workaround 😄 ? @BenMansley @GemN @robmcfeely
from heml.
from heml.
@robmcfeely Okay, thank your for your reply ! 👍
from heml.
@GemN Great workaround !
I think I would have used your solution if I wouldn't must dynamically generate content using loops or conditions.
I created a small class that spawns 4 Node.js thread workers, each of them executing the heml
function while waiting for the previous execution to be completed in order to prevent race conditions we encountered.
Like that I don't need to rely on HEML CLI.
The Gist containing the code : https://gist.github.com/Devessier/f17c3bf4e7f9a799059d1fec110ba841
from heml.
Related Issues (20)
- Haml to html conversion problem!
- Background image support? HOT 1
- Multiple security vulnerabilities
- online editor not working anymore ? HOT 2
- Is project still alive?
- Pseudo-Element Styling Not Working HOT 2
- The Editor doesn't work anymore HOT 1
- Feature request: placeholders
- Add `from: undefined` to hide warnings from PostCSS HOT 1
- heml: command not found HOT 1
- Feature request: centering & spacers
- Feature request: Build entire folder HOT 2
- Update axios in @heml/elements to avoid security alert
- TypeScript Definitions HOT 2
- Node#moveTo was deprecated. Use Container#append.
- Is this module still under development? HOT 1
- Charts component for emails - do you accept external contributions?
- Heml fork - This project has the potential to be something big. HOT 4
- Comparison with MJML HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from heml.