is this it?

This commit is contained in:
Talon Poole 2021-02-25 17:19:27 +00:00
parent 267576aa4d
commit f62f270e5e
5 changed files with 13 additions and 11 deletions

5
cli.js
View file

@ -89,10 +89,7 @@ Object.keys(CSS_VARS).forEach((key) => {
cli.conflicts(key, "core");
cli.conflicts(key, "none");
});
cli.group(
Object.keys(CSS_VARS),
`${css}:`
);
cli.group(Object.keys(CSS_VARS), `${css}:`);
const argv = cli
.conflicts("author", "body")

7
css.js
View file

@ -46,7 +46,8 @@ export function load(options) {
if (
!["gmi.css", "gmi-web.css"].includes(options.css) ||
!existsSync(options.css)
) throw new Error(`Cannot find file ${options.css}.`);
)
throw new Error(`Cannot find file ${options.css}.`);
const internal = (file) =>
path.resolve(path.dirname(new URL(import.meta.url).pathname), file);
@ -69,7 +70,9 @@ export function rootVariables(rules) {
if (!root) return {};
return root.declarations.reduce(
(obj, { property, value }) =>
!/^\-\-/.test(property) ? obj : Object.assign(obj, { [property.replace("--", "")]: value }),
!/^\-\-/.test(property)
? obj
: Object.assign(obj, { [property.replace("--", "")]: value }),
{}
);
}

View file

@ -26,7 +26,7 @@ fashion!
Use *--author* _NAME_ to set the author <meta> tag on every file.
Use *--descriptions* [_LIMIT_] to apply the first non-empty text line of each
Use *--description* [_LIMIT_] to apply the first non-empty text line of each
file as the description <meta> tag. _LIMIT_ may be used to truncate the text
with an ellipsis at that number of characters.

View file

@ -141,11 +141,13 @@ export function head(tokens, options) {
<meta name="viewport" content="width=device-width,initial-scale=1">${
options.styleTag
}
<title>${tokens.find(({h1}) => h1).h1 || ""}</title>${
options.author ? `\n<meta name="author" content="${options.author}">` : ""
<title>${tokens.find(({ h1 }) => h1).h1 || ""}</title>${
options.author ? `\n<meta name="author" content="${options.author}">` : ""
}${
description
? `\n<meta name="description" content="${escape(truncate(description.text, options.description))}">`
? `\n<meta name="description" content="${escape(
truncate(description.text, options.description)
)}">`
: ""
}${
options.canonical

View file

@ -1,6 +1,6 @@
{
"name": "gmi-web-cli",
"version": "1.0.0-rc.4",
"version": "1.0.0",
"description": "A bridge between Gemini and HTML",
"main": "html.js",
"type": "module",