marilena
Advanced tools
Comparing version 0.0.7 to 0.0.9
@@ -13,3 +13,3 @@ "use strict"; | ||
function buildSingle(config, emailName) { | ||
const { inputFolder, outputFolder, locales, templateSuffix } = config; | ||
const { inputFolder, outputFolder, locales, templateSuffix, mjmlParsingOptions, } = config; | ||
const inputFolderPath = path_1.default.join(inputFolder); | ||
@@ -30,2 +30,3 @@ const outputFolderPath = path_1.default.join(outputFolder); | ||
templateOptions: config.templateOptions, | ||
mjmlParsingOptions, | ||
}); | ||
@@ -32,0 +33,0 @@ const folderEmailPathLang = path_1.default.join(outputFolderPath, emailName, locale); |
@@ -36,3 +36,3 @@ "use strict"; | ||
const isTextExecution = process.env.NODE_ENV === "test"; | ||
async function inputOutputHtml({ inputHtml, variables, templateOptions, }) { | ||
async function inputOutputHtml({ inputHtml, variables, templateOptions, mjmlParsingOptions, }) { | ||
async function rendereWithVars() { | ||
@@ -70,5 +70,5 @@ if (!templateOptions) { | ||
} | ||
const html = (0, mjml_1.default)(mjmlTenplateWithVars).html; | ||
const html = (0, mjml_1.default)(mjmlTenplateWithVars, mjmlParsingOptions).html; | ||
return html; | ||
} | ||
exports.inputOutputHtml = inputOutputHtml; |
@@ -14,3 +14,3 @@ "use strict"; | ||
const config = await (0, utils_1.loadConfig)(); | ||
const { inputFolder } = config; | ||
const { inputFolder, mjmlParsingOptions } = config; | ||
const email = request.params.email; | ||
@@ -23,2 +23,3 @@ const locale = request.params.locale; | ||
templateOptions: config.templateOptions, | ||
mjmlParsingOptions, | ||
}); | ||
@@ -25,0 +26,0 @@ const htmlWithWebsocketScript = (0, injectWebSocketNodeScript_1.inject)(html); |
{ | ||
"name": "marilena", | ||
"version": "0.0.7", | ||
"version": "0.0.9", | ||
"description": "a tool to build emails with cool tools like mjml and different template engine lime handlebars or eta.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -15,2 +15,12 @@ # Intro | ||
0 - setup your `package.json`: | ||
```json | ||
"scripts": { | ||
"start": "marilena --server", | ||
"build": "marilena --build", | ||
...other | ||
}, | ||
``` | ||
1 - create a `marilena.config.js` file under root of your project: | ||
@@ -87,3 +97,3 @@ | ||
| name | required | description | default | | ||
|-----------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| | ||
|--------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| | ||
| templateSuffix | X | extension of files used for email. Used for filter and can any value | .html | | ||
@@ -94,2 +104,3 @@ | inputFolder | X | folder where email are in the project | input | | ||
| templateOptions | | if you chose to use one of supported engines, this part id required to setup custom partial and other settings for the template engine selected. Read below for some use cases | empty | | ||
| mjmlParsingOptions | | options passed to mjml render. See: [mjml options](https://www.npmjs.com/package/mjml) | ||
@@ -100,3 +111,3 @@ ## About templateOptions | ||
- `engine`: a subset of fastify supported template engine. At this moment `["eta","handlebars"]` are supported. Apart `eta`, which is used also in the project library, all others require and installation of the engine since `marilena` use lazy import for engines. | ||
- `engine`: `eta` or `handlebars` are supported. Apart `eta`, which is used also in the project library, all others requires dependency installed since `marilena` use lazy import for engines. | ||
- `variablesType`: define if variables are loaded from json file or yaml file. At this moment only `json` are supported. | ||
@@ -136,9 +147,10 @@ - `prepareEngine`: define a callback where we can setup our engine. Basically you can define all things before the render. For example: | ||
- [x] eta.js, handlebars | ||
- [ ] ejs, nunjucks, mustache, dot, liquid | ||
- [x] fast-refresh on variables changes | ||
- [x] fast-refresh on template change | ||
- [ ] fast-refresh on config change | ||
- [x] load varibles from yaml format | ||
- [x] load common variables | ||
- [x] pass option to MJML render | ||
- [ ] config in typescript | ||
- [ ] ejs, nunjucks, mustache, dot, liquid | ||
- [ ] easy way to send a real email | ||
- [ ] pass option to MJML render | ||
- [ ] fast-refresh on config change |
28871
501
152