diff --git a/css.js b/css.js index 2c747b7..559bd68 100644 --- a/css.js +++ b/css.js @@ -20,23 +20,29 @@ export function style(options) { export const inline = (options) => { const rules = load(options); return function inlineCSS(tag) { - if (!options.inline || options.css === "none") return ""; - const styles = reduceVariables(rules, options) - .filter(({ selectors }) => selectors && selectors.includes(tag)) - .reduce((style, { declarations }) => { - declarations.forEach(({ property, value }) => { - style = `${style}${property}:${value};`; - }); - return style; - }, ""); - return styles !== "" ? ` style="${styles}"` : ""; + if ((options.body || options.inline) && options.css !== "none") { + const styles = reduceVariables(rules, options) + .filter(({ selectors }) => selectors && selectors.includes(tag)) + .reduce((style, { declarations }) => { + declarations.forEach(({ property, value }) => { + style = `${style}${property}:${value};`; + }); + return style; + }, ""); + return styles !== "" ? ` style="${styles}"` : ""; + } else { + return ""; + } }; }; export function load(options) { - options.css = - options.css || - (!options.body || !options.inline ? "gmi-web.css" : "gmi.css"); + if (options.css === "none") return []; + options.css = options.css + ? options.css + : options.body + ? "gmi.css" + : "gmi-web.css"; if ( ["gmi.css", "gmi-web.css"].includes(options.css) || existsSync(options.css) diff --git a/package-lock.json b/package-lock.json index 47b8d31..fa421f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gmi-web-cli", - "version": "1.0.0-rc.3", + "version": "1.0.2-rc.3", "lockfileVersion": 1, "requires": true, "dependencies": {