Stabilize Frost and prepare npm package
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { gzipSync } from "node:zlib";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const files = ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css"];
|
||||
const source = (await Promise.all(files.map((file) => readFile(resolve(root, file), "utf8")))).join("\n");
|
||||
const rawBytes = Buffer.byteLength(source);
|
||||
const gzipBytes = gzipSync(source).byteLength;
|
||||
console.log(`Combined CSS: ${rawBytes} bytes raw, ${gzipBytes} bytes gzip`);
|
||||
if (gzipBytes > 10 * 1024) {
|
||||
console.error("Warning: Frost exceeds the 10 KB gzip budget.");
|
||||
process.exitCode = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user