@podium/utils
Advanced tools
Comparing version 4.0.0-next.1 to 4.0.0-next.2
@@ -253,5 +253,18 @@ 'use strict'; | ||
title = '', | ||
js = '', | ||
css = '', | ||
} = {}) => `<!doctype html> | ||
js = [], | ||
css = [], | ||
} = {}) => { | ||
let scripts = js; | ||
let styles = css; | ||
const buildScriptTag = ({ value = '' }) => | ||
`<script src="${value}" defer></script>`; | ||
const buildCSSLinkTag = ({ value = '' }) => | ||
`<link rel="stylesheet" type="text/css" href="${value}">`; | ||
// backwards compatibility for scripts and styles | ||
if (typeof js === 'string') scripts = [{ type: 'default', value: js }]; | ||
if (typeof css === 'string') styles = [{ type: 'default', value: css }]; | ||
return `<!doctype html> | ||
<html lang="${locale}"> | ||
@@ -262,8 +275,4 @@ <head> | ||
<meta http-equiv="X-UA-Compatible" content="IE=Edge"> | ||
${js ? `<script src="${js}" defer></script>` : ''} | ||
${ | ||
css | ||
? `<link media="all" rel="stylesheet" type="text/css" href="${css}">` | ||
: '' | ||
} | ||
${styles.map(buildCSSLinkTag).join('\n ')} | ||
${scripts.map(buildScriptTag).join('\n ')} | ||
<title>${title}</title> | ||
@@ -276,2 +285,3 @@ ${head} | ||
</html>`; | ||
}; | ||
@@ -278,0 +288,0 @@ module.exports.isString = isString; |
{ | ||
"name": "@podium/utils", | ||
"version": "4.0.0-next.1", | ||
"version": "4.0.0-next.2", | ||
"description": "Common generic utility methods shared by @podium modules.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
22038
398