mjml-core
Advanced tools
Comparing version
@@ -18,4 +18,5 @@ 'use strict'; | ||
function buildFontsTags(content) { | ||
var fonts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
// eslint-disable-next-line import/prefer-default-export | ||
function buildFontsTags(content, inlineStyle) { | ||
var fonts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -26,4 +27,7 @@ var toImport = []; | ||
var regex = new RegExp('"[^"]*font-family:[^"]*' + name + '[^"]*"', 'gmi'); | ||
var inlineRegex = new RegExp('font-family:[^;}]*' + name, 'gmi'); | ||
if (content.match(regex)) { | ||
if (content.match(regex) || inlineStyle.some(function (s) { | ||
return s.match(inlineRegex); | ||
})) { | ||
toImport.push(url); | ||
@@ -30,0 +34,0 @@ } |
@@ -39,6 +39,7 @@ 'use strict'; | ||
style = options.style, | ||
forceOWADesktop = options.forceOWADesktop; | ||
forceOWADesktop = options.forceOWADesktop, | ||
inlineStyle = options.inlineStyle; | ||
return '\n <!doctype html>\n <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">\n <head>\n <title>\n ' + title + '\n </title>\n <!--[if !mso]><!-- -->\n <meta http-equiv="X-UA-Compatible" content="IE=edge">\n <!--<![endif]-->\n <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <style type="text/css">\n #outlook a { padding:0; }\n .ReadMsgBody { width:100%; }\n .ExternalClass { width:100%; }\n .ExternalClass * { line-height:100%; }\n body { margin:0;padding:0;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%; }\n table, td { border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt; }\n img { border:0;height:auto;line-height:100%; outline:none;text-decoration:none;-ms-interpolation-mode:bicubic; }\n p { display:block;margin:13px 0; }\n </style>\n <!--[if !mso]><!-->\n <style type="text/css">\n @media only screen and (max-width:480px) {\n @-ms-viewport { width:320px; }\n @viewport { width:320px; }\n }\n </style>\n <!--<![endif]-->\n <!--[if mso]>\n <xml>\n <o:OfficeDocumentSettings>\n <o:AllowPNG/>\n <o:PixelsPerInch>96</o:PixelsPerInch>\n </o:OfficeDocumentSettings>\n </xml>\n <![endif]-->\n <!--[if lte mso 11]>\n <style type="text/css">\n .outlook-group-fix { width:100% !important; }\n </style>\n <![endif]-->\n ' + (0, _fonts.buildFontsTags)(content, fonts) + '\n ' + (0, _mediaQueries.buildMediaQueriesTags)(breakpoint, mediaQueries, forceOWADesktop) + '\n <style type="text/css">\n ' + (0, _lodash.reduce)(componentsHeadStyle, function (result, compHeadStyle) { | ||
return '\n <!doctype html>\n <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">\n <head>\n <title>\n ' + title + '\n </title>\n <!--[if !mso]><!-- -->\n <meta http-equiv="X-UA-Compatible" content="IE=edge">\n <!--<![endif]-->\n <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <style type="text/css">\n #outlook a { padding:0; }\n .ReadMsgBody { width:100%; }\n .ExternalClass { width:100%; }\n .ExternalClass * { line-height:100%; }\n body { margin:0;padding:0;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%; }\n table, td { border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt; }\n img { border:0;height:auto;line-height:100%; outline:none;text-decoration:none;-ms-interpolation-mode:bicubic; }\n p { display:block;margin:13px 0; }\n </style>\n <!--[if !mso]><!-->\n <style type="text/css">\n @media only screen and (max-width:480px) {\n @-ms-viewport { width:320px; }\n @viewport { width:320px; }\n }\n </style>\n <!--<![endif]-->\n <!--[if mso]>\n <xml>\n <o:OfficeDocumentSettings>\n <o:AllowPNG/>\n <o:PixelsPerInch>96</o:PixelsPerInch>\n </o:OfficeDocumentSettings>\n </xml>\n <![endif]-->\n <!--[if lte mso 11]>\n <style type="text/css">\n .outlook-group-fix { width:100% !important; }\n </style>\n <![endif]-->\n ' + (0, _fonts.buildFontsTags)(content, inlineStyle, fonts) + '\n ' + (0, _mediaQueries.buildMediaQueriesTags)(breakpoint, mediaQueries, forceOWADesktop) + '\n <style type="text/css">\n ' + (0, _lodash.reduce)(componentsHeadStyle, function (result, compHeadStyle) { | ||
return result + '\n' + compHeadStyle(breakpoint); | ||
@@ -45,0 +46,0 @@ }, '') + '\n ' + (0, _lodash.reduce)(headStyle, function (result, headStyle) { |
@@ -244,3 +244,3 @@ 'use strict'; | ||
globalDatas.mediaQueries[className] = '{ width:' + parsedWidth + unit + ' !important; }'; | ||
globalDatas.mediaQueries[className] = '{ width:' + parsedWidth + unit + ' !important; max-width: ' + parsedWidth + unit + '; }'; | ||
}, | ||
@@ -288,2 +288,6 @@ addHeadSyle: function addHeadSyle(identifier, headStyle) { | ||
content = skeleton((0, _extends3.default)({ | ||
content: content | ||
}, globalDatas)); | ||
if (globalDatas.inlineStyle.length > 0) { | ||
@@ -298,6 +302,2 @@ content = (0, _juice2.default)(content, { | ||
content = skeleton((0, _extends3.default)({ | ||
content: content | ||
}, globalDatas)); | ||
content = beautify && beautify !== 'false' ? (0, _jsBeautify.html)(content, { | ||
@@ -313,3 +313,4 @@ indent_size: 2, | ||
minifyCSS: false, | ||
removeEmptyAttributes: true | ||
removeEmptyAttributes: true, | ||
processConditionalComments: true | ||
}) : content; | ||
@@ -316,0 +317,0 @@ |
{ | ||
"name": "mjml-core", | ||
"description": "mjml-core", | ||
"version": "4.0.1", | ||
"version": "4.0.4", | ||
"main": "lib/index.js", | ||
@@ -16,6 +16,7 @@ "repository": { | ||
"scripts": { | ||
"clean": "../../node_modules/.bin/rimraf lib", | ||
"build": "../../node_modules/.bin/babel src --out-dir lib" | ||
"clean": "cross-env ../../node_modules/.bin/rimraf lib", | ||
"build": "cross-env ../../node_modules/.bin/babel src --out-dir lib" | ||
}, | ||
"dependencies": { | ||
"cross-env": "^5.1.4", | ||
"html-minifier": "^3.5.3", | ||
@@ -25,6 +26,6 @@ "js-beautify": "^1.6.14", | ||
"lodash": "^4.17.3", | ||
"mjml-migrate": "^4.0.1", | ||
"mjml-parser-xml": "^4.0.1", | ||
"mjml-validator": "^4.0.1" | ||
"mjml-migrate": "^4.0.4", | ||
"mjml-parser-xml": "^4.0.4", | ||
"mjml-validator": "^4.0.4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
128576
0.62%2185
0.32%8
14.29%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
Updated
Updated
Updated