mjml-core
Advanced tools
Comparing version 3.3.0-beta.2 to 3.3.0-beta.3
@@ -7,4 +7,8 @@ 'use strict'; | ||
var insertHeadCSS = exports.insertHeadCSS = function insertHeadCSS($, headCSS) { | ||
$('head').append('<style type="text/css">' + headCSS + '</style>'); | ||
if (!headCSS || headCSS.length == 0) { | ||
return $; | ||
} | ||
$('head').append('<style type="text/css">' + headCSS.join('') + '</style>'); | ||
return $; | ||
@@ -11,0 +15,0 @@ }; |
@@ -60,3 +60,8 @@ 'use strict'; | ||
if (head) { | ||
headStack.push(head); | ||
var headLength = headStack.length; | ||
head = head.replace(includes, replaceContent.bind(undefined, _path2.default.resolve(_path2.default.dirname(filePath)), headStack)); | ||
// head.replace can add new element to the array | ||
// we have to keep the initial position where we want to insert | ||
// current mj-head in order to keep definition order | ||
headStack.splice(headLength - 1, 0, head); | ||
} | ||
@@ -68,3 +73,3 @@ | ||
return content; | ||
return content || ''; | ||
}; | ||
@@ -71,0 +76,0 @@ |
@@ -61,3 +61,3 @@ 'use strict'; | ||
var version = exports.version = function version() { | ||
return '3.2.0'; | ||
return '3.3.0-beta.3'; | ||
}; | ||
@@ -64,0 +64,0 @@ var MJMLValidator = exports.MJMLValidator = _mjmlValidator2.default; |
@@ -119,5 +119,9 @@ 'use strict'; | ||
var inlineExternal = function inlineExternal(htmlDocument, css) { | ||
if (!css || css.length == 0) { | ||
return htmlDocument; | ||
} | ||
var juice = require('juice'); | ||
return juice(htmlDocument, { extraCss: css, removeStyleTags: false, applyStyleTags: false, insertPreservedExtraCss: false }); | ||
return juice(htmlDocument, { extraCss: css.join('\n'), removeStyleTags: false, applyStyleTags: false, insertPreservedExtraCss: false }); | ||
}; | ||
@@ -165,3 +169,4 @@ | ||
if (this.options.level == "skip") { | ||
return []; | ||
this.errors = []; | ||
return; | ||
} | ||
@@ -187,3 +192,3 @@ | ||
if (head && head.children.length > 1) { | ||
if (head && head.children.length > 0) { | ||
(0, _each2.default)(head.children, function (headElement) { | ||
@@ -221,3 +226,3 @@ var handlerName = headElement.tagName; | ||
value: function postRender(MJMLDocument) { | ||
var externalCSS = this.attributes.inlineCSS.join(''); | ||
var externalCSS = this.attributes.inlineCSS; | ||
@@ -229,3 +234,3 @@ var $ = _dom2.default.parseHTML(MJMLDocument); | ||
$ = (0, _postRender.fixLegacyAttrs)($); | ||
$ = (0, _postRender.insertHeadCSS)($, this.attributes.css.join('')); | ||
$ = (0, _postRender.insertHeadCSS)($, this.attributes.css); | ||
@@ -232,0 +237,0 @@ _MJMLElementsCollection.postRenders.forEach(function (postRender) { |
{ | ||
"name": "mjml-core", | ||
"description": "mjml-core", | ||
"version": "3.3.0-beta.2", | ||
"version": "3.3.0-beta.3", | ||
"main": "lib/index.js", | ||
@@ -35,3 +35,3 @@ "scripts": { | ||
"lodash": "^4.17.4", | ||
"mjml-validator": "~3.3.0-beta.2", | ||
"mjml-validator": "~3.3.0-beta.3", | ||
"react": "^15.4.2", | ||
@@ -38,0 +38,0 @@ "react-dom": "^15.4.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
4
55244
25
1194
Updatedmjml-validator@~3.3.0-beta.3