From 3b9e0a7ed3b9287e36ff0d7b9bd55cee0421e53e Mon Sep 17 00:00:00 2001 From: Talon Poole Date: Thu, 25 Feb 2021 20:44:09 +0000 Subject: [PATCH] booelan logic smh --- cli.js | 6 +++++- css.js | 5 ++--- package-lock.json | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cli.js b/cli.js index d02cbd3..144af50 100755 --- a/cli.js +++ b/cli.js @@ -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) { diff --git a/css.js b/css.js index aea746a..92f4a8e 100644 --- a/css.js +++ b/css.js @@ -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( diff --git a/package-lock.json b/package-lock.json index e4f9c1b..1e3569d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": {