Files
ancsemi 984b6ffceb Split style.css (20,790 lines) into sixteen files by area, a pure move
style.css now only imports the parts in order, after voice.css and
music.css as before, so the cascade is unchanged. Each cut sits between
top-level rules. Checked twice: the parts (minus the one-line header each
got) rebuild the old file byte for byte, and a browser loading the new
style.css ends up with the same 3,526 rules, in the same order, as it parses
from the old one. The largest part is 1,559 lines. Tests that read
style.css now read it with its imports filled in (test/coreCss.js), and the
theme contract test names the part each checked rule lives in.
2026-10-02 11:16:06 -04:00

20 lines
739 B
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use strict';
// style.css is a list of @import lines; the rules live in the files it
// imports. Tests that look for a rule read the stylesheet the way a browser
// does: style.css with every imported file put in place of its @import line.
const fs = require('node:fs');
const path = require('node:path');
const CSS_DIR = path.join(__dirname, '..', 'public', 'css');
function readCss(file, seen = new Set()) {
if (seen.has(file)) return '';
seen.add(file);
const text = fs.readFileSync(path.join(CSS_DIR, file), 'utf8').replace(/^/, '');
return text.replace(/@import url\('\/css\/([\w.-]+\.css)(?:\?[^']*)?'\);/g, (_, name) => readCss(name, seen));
}
module.exports = { readCoreCss: () => readCss('style.css'), CSS_DIR };