@brilab-mailer/template-handlebars 0.0.5-1 → 0.0.5-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlebars-template.engine.d.ts","sourceRoot":"","sources":["../../src/lib/handlebars-template.engine.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,oBAAoB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACX,sCAAsC,EACtC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"handlebars-template.engine.d.ts","sourceRoot":"","sources":["../../src/lib/handlebars-template.engine.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,oBAAoB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACX,sCAAsC,EACtC,MAAM,0BAA0B,CAAC;AAMlC,UAAU,gBACT,SAAQ,sCAAsC;CAC9C;AAED,qBACa,wBAAyB,YAAW,oBAAoB;IAYnE,OAAO,CAAC,QAAQ,CAAC,OAAO;IAXzB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAuB;IAE3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkD;IAChF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkD;IAE9E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAInB,OAAO,EAAE,gBAAgB;IAkB3C,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,uBAAuB;IAkC/B,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,UAAU;IAaZ,MAAM,CACX,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACjC,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAA6B,GACxD,OAAO,CAAC,MAAM,CAAC;CAYlB"}
|
|
@@ -4,6 +4,7 @@ import { MAILER_TEMPLATE_ENGINE_OPTIONS, } from '@brilab-mailer/contracts';
|
|
|
4
4
|
import * as fs from 'fs';
|
|
5
5
|
import * as path from 'path';
|
|
6
6
|
import Handlebars from 'handlebars';
|
|
7
|
+
import juice from 'juice';
|
|
7
8
|
let HandlebarsTemplateEngine = class HandlebarsTemplateEngine {
|
|
8
9
|
options;
|
|
9
10
|
hbs = Handlebars.create();
|
|
@@ -96,9 +97,10 @@ let HandlebarsTemplateEngine = class HandlebarsTemplateEngine {
|
|
|
96
97
|
const template = this.loadTemplate(templateKey);
|
|
97
98
|
const bodyHtml = template(context);
|
|
98
99
|
const layout = this.loadLayout(options?.layoutKey || 'default');
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
const fullHtml = layout
|
|
101
|
+
? layout({ ...context, body: bodyHtml })
|
|
102
|
+
: bodyHtml;
|
|
103
|
+
return juice(fullHtml);
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
106
|
HandlebarsTemplateEngine = __decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brilab-mailer/template-handlebars",
|
|
3
|
-
"version": "0.0.5-
|
|
3
|
+
"version": "0.0.5-2",
|
|
4
4
|
"author": "Bohdan Radchenko <radchenkobs@gmail.com>",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@nestjs/common": "^10.0.0",
|
|
28
28
|
"@nestjs/config": "^3.0.0",
|
|
29
|
-
"@brilab-mailer/contracts": "^0.0.5-
|
|
30
|
-
"@brilab-mailer/core": "^0.0.5-
|
|
29
|
+
"@brilab-mailer/contracts": "^0.0.5-2",
|
|
30
|
+
"@brilab-mailer/core": "^0.0.5-2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependenciesMeta": {
|
|
33
33
|
"@brilab-mailer/contracts": {
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"handlebars": "4.7.8"
|
|
41
|
+
"handlebars": "4.7.8",
|
|
42
|
+
"juice": "^11.0.3"
|
|
42
43
|
}
|
|
43
44
|
}
|