booelan logic smh

This commit is contained in:
Talon Poole 2021-02-25 20:44:09 +00:00
parent 7196999957
commit 3b9e0a7ed3
3 changed files with 8 additions and 5 deletions

6
cli.js
View file

@ -5,7 +5,11 @@ import fs from "vinyl-fs";
import yargs from "yargs";
import * as CSS from "./css.js";
import { streamHTML, toHTML } from "./html.js";
const pkg = JSON.parse(readFileSync(path.resolve("package.json"), "utf-8"));
export const internal = (file) =>
path.resolve(path.dirname(new URL(import.meta.url).pathname), file);
const pkg = JSON.parse(readFileSync(internal("package.json"), "utf-8"));
const cli = yargs(process.argv.slice(2))
.config("config", function (path) {

5
css.js
View file

@ -2,6 +2,7 @@ import { readFileSync, existsSync } from "fs";
// TODO import.meta.resolve is supposed to accomplish this without "path"
import path from "path";
import { stringify, parse } from "css";
import { internal } from "./cli.js"
export function style(options) {
if (options.inline || options.css === "none") return "";
@ -44,13 +45,11 @@ export function load(options) {
: "gmi-web.css";
if (
!["gmi.css", "gmi-web.css"].includes(options.css) ||
!["gmi.css", "gmi-web.css"].includes(options.css) &&
!existsSync(options.css)
)
throw new Error(`Cannot find file ${options.css}.`);
const internal = (file) =>
path.resolve(path.dirname(new URL(import.meta.url).pathname), file);
return parse(
readFileSync(
path.resolve(

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "gmi-web-cli",
"version": "1.0.4-rc.4",
"version": "1.0.7-rc.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {