feat: refs #6367 mixStyles
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Pablo Natek 2024-05-02 14:58:54 +02:00
parent c91b745f0e
commit d99e002cc7
6 changed files with 8 additions and 30 deletions

View File

@ -74,11 +74,10 @@ class Component {
} }
get stylesheet() { get stylesheet() {
let mergedStyles = '';
const stylePath = path.resolve(__dirname, `${this.path}/assets/css`); const stylePath = path.resolve(__dirname, `${this.path}/assets/css`);
if (!fs.existsSync(stylePath)) if (!fs.existsSync(stylePath))
return mergedStyles; return '';
return require(`${stylePath}/import`); return require(`${stylePath}/import`);
} }
@ -101,6 +100,7 @@ class Component {
const component = require(`${this.path}/${this.name}`); const component = require(`${this.path}/${this.name}`);
component.i18n = this.locale; component.i18n = this.locale;
component.attachments = this.attachments; component.attachments = this.attachments;
console.log('this.stylesheet: ', this.stylesheet);
component.template = juice.inlineContent(this.template, this.stylesheet, { component.template = juice.inlineContent(this.template, this.stylesheet, {
inlinePseudoElements: true inlinePseudoElements: true
}); });

View File

@ -1,5 +1,4 @@
const fs = require('fs-extra'); const fs = require('fs-extra');
const path = require('path');
class Stylesheet { class Stylesheet {
constructor(files) { constructor(files) {
@ -8,9 +7,8 @@ class Stylesheet {
} }
mergeStyles() { mergeStyles() {
for (const file of this.files) { for (const file of this.files)
this.css.push(fs.readFileSync(file)); this.css.push(fs.readFileSync(file));
}
return this.css.join('\n'); return this.css.join('\n');
} }

View File

@ -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
}
}
};

View File

@ -1,3 +0,0 @@
subject: Asunto
title: Titulo
text: Texto

View File

@ -7,6 +7,7 @@ module.exports = new Stylesheet([
`${vnPrintPath}/common/css/spacing.css`, `${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`, `${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`, `${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/email.css`]) `${vnPrintPath}/common/css/email.css`,
`${__dirname}/style.css`])
.mergeStyles(); .mergeStyles();

View File

@ -0,0 +1,3 @@
.claseTest{
color: red;
}