fix body + css
This commit is contained in:
parent
692fd5fe91
commit
88f1bb3c8b
32
css.js
32
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)
|
||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -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": {
|
||||
|
|
Loading…
Reference in a new issue