From d99e002cc7a6923582f96eb8c4ec99c8e7d58447 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 2 May 2024 14:58:54 +0200 Subject: [PATCH] feat: refs #6367 mixStyles --- print/core/component.js | 4 ++-- print/core/stylesheet.js | 4 +--- .../email/aaaPrExample/aaaPrExample.js | 21 ------------------- .../email/aaaPrExample/locale/en.yml | 3 --- .../letter-debtor-nd/assets/css/import.js | 3 ++- .../letter-debtor-nd/assets/css/style.css | 3 +++ 6 files changed, 8 insertions(+), 30 deletions(-) delete mode 100644 print/templates/email/aaaPrExample/aaaPrExample.js delete mode 100644 print/templates/email/aaaPrExample/locale/en.yml create mode 100644 print/templates/email/letter-debtor-nd/assets/css/style.css diff --git a/print/core/component.js b/print/core/component.js index 06ef3033a..0a8095483 100644 --- a/print/core/component.js +++ b/print/core/component.js @@ -74,11 +74,10 @@ class Component { } get stylesheet() { - let mergedStyles = ''; const stylePath = path.resolve(__dirname, `${this.path}/assets/css`); if (!fs.existsSync(stylePath)) - return mergedStyles; + return ''; return require(`${stylePath}/import`); } @@ -101,6 +100,7 @@ class Component { const component = require(`${this.path}/${this.name}`); component.i18n = this.locale; component.attachments = this.attachments; + console.log('this.stylesheet: ', this.stylesheet); component.template = juice.inlineContent(this.template, this.stylesheet, { inlinePseudoElements: true }); diff --git a/print/core/stylesheet.js b/print/core/stylesheet.js index 195044f02..42a44fb57 100644 --- a/print/core/stylesheet.js +++ b/print/core/stylesheet.js @@ -1,5 +1,4 @@ const fs = require('fs-extra'); -const path = require('path'); class Stylesheet { constructor(files) { @@ -8,9 +7,8 @@ class Stylesheet { } mergeStyles() { - for (const file of this.files) { + for (const file of this.files) this.css.push(fs.readFileSync(file)); - } return this.css.join('\n'); } diff --git a/print/templates/email/aaaPrExample/aaaPrExample.js b/print/templates/email/aaaPrExample/aaaPrExample.js deleted file mode 100644 index b09ff38dc..000000000 --- a/print/templates/email/aaaPrExample/aaaPrExample.js +++ /dev/null @@ -1,21 +0,0 @@ - -const Component = require(`vn-print/core/component`); -const emailBody = new Component('email-body'); -module.exports = { - name: 'blank-notification', - components: { - 'email-body': emailBody.build() - }, - props: { - subject: { - type: String - }, - title: { - type: String, - required: true - }, - text: { - type: String - } - } -}; diff --git a/print/templates/email/aaaPrExample/locale/en.yml b/print/templates/email/aaaPrExample/locale/en.yml deleted file mode 100644 index 5a2aa7b27..000000000 --- a/print/templates/email/aaaPrExample/locale/en.yml +++ /dev/null @@ -1,3 +0,0 @@ -subject: Asunto -title: Titulo -text: Texto \ No newline at end of file diff --git a/print/templates/email/letter-debtor-nd/assets/css/import.js b/print/templates/email/letter-debtor-nd/assets/css/import.js index 1582b82c5..7360587f7 100644 --- a/print/templates/email/letter-debtor-nd/assets/css/import.js +++ b/print/templates/email/letter-debtor-nd/assets/css/import.js @@ -7,6 +7,7 @@ module.exports = new Stylesheet([ `${vnPrintPath}/common/css/spacing.css`, `${vnPrintPath}/common/css/misc.css`, `${vnPrintPath}/common/css/layout.css`, - `${vnPrintPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/email.css`, + `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/email/letter-debtor-nd/assets/css/style.css b/print/templates/email/letter-debtor-nd/assets/css/style.css new file mode 100644 index 000000000..695643611 --- /dev/null +++ b/print/templates/email/letter-debtor-nd/assets/css/style.css @@ -0,0 +1,3 @@ +.claseTest{ + color: red; +} \ No newline at end of file