marilena
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -19,3 +19,3 @@ "use strict"; | ||
// create folder for each email and locale if not exist | ||
locales.forEach((locale) => { | ||
locales.forEach(async (locale) => { | ||
const emailFolderPath = path_1.default.join(outputFolderPath, emailName, locale); | ||
@@ -26,3 +26,3 @@ if (!fs_1.default.existsSync(emailFolderPath)) { | ||
const variables = (0, loadVariables_1.default)({ config, locale, emailName }); | ||
const html = (0, inputOutputHtml_1.inputOutputHtml)({ | ||
const html = await (0, inputOutputHtml_1.inputOutputHtml)({ | ||
inputHtml: mjmlTemplate, | ||
@@ -29,0 +29,0 @@ variables, |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -9,8 +32,8 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
const eta_1 = __importDefault(require("eta")); | ||
const handlebars_1 = __importDefault(require("handlebars")); | ||
// import handlebars from "handlebars"; | ||
const node_color_log_1 = __importDefault(require("node-color-log")); | ||
const const_1 = require("../const"); | ||
const isTextExecution = process.env.NODE_ENV === "test"; | ||
function inputOutputHtml({ inputHtml, variables, templateOptions, }) { | ||
function rendereWithVars() { | ||
async function inputOutputHtml({ inputHtml, variables, templateOptions, }) { | ||
async function rendereWithVars() { | ||
if (!templateOptions) { | ||
@@ -31,6 +54,7 @@ return inputHtml; | ||
case "handlebars": { | ||
const handlebars = await Promise.resolve().then(() => __importStar(require("handlebars"))); | ||
if (!!prepareEngine) { | ||
prepareEngine(handlebars_1.default); | ||
prepareEngine(handlebars); | ||
} | ||
return handlebars_1.default.compile(inputHtml)(variables); | ||
return handlebars.compile(inputHtml)(variables); | ||
} | ||
@@ -43,3 +67,3 @@ default: { | ||
} | ||
const mjmlTenplateWithVars = rendereWithVars(); | ||
const mjmlTenplateWithVars = await rendereWithVars(); | ||
if (isTextExecution) { | ||
@@ -46,0 +70,0 @@ return mjmlTenplateWithVars; |
@@ -18,3 +18,3 @@ "use strict"; | ||
const mjmlTemplate = fs_1.default.readFileSync(`${inputFolder}/${email}/index${config.templateSuffix}`, "utf-8"); | ||
const html = (0, inputOutputHtml_1.inputOutputHtml)({ | ||
const html = await (0, inputOutputHtml_1.inputOutputHtml)({ | ||
inputHtml: mjmlTemplate, | ||
@@ -21,0 +21,0 @@ variables: (0, loadVariables_1.default)({ config, emailName: email, locale }), |
{ | ||
"name": "marilena", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "a tool to build emails with cool tools like mjml and different template engine lime handlebars or eta.js", | ||
@@ -17,5 +17,10 @@ "scripts": { | ||
}, | ||
"repository": { | ||
"type": "github", | ||
"url": "https://github.com/multivoltage/marilena" | ||
}, | ||
"files": [ | ||
"bin", | ||
"dist" | ||
"dist", | ||
"README.md" | ||
], | ||
@@ -22,0 +27,0 @@ "keywords": [ |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
26346
468
7