mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-30 08:05:13 +08:00
update 2026-09-20 01:22:33
This commit is contained in:
1 parent
42e0cfbec4
commit
deb27aee9d
864 files changed
+180566
-42
No files matched your search
@@ -0,0 +1,27 @@
|
||||
/* Build the stylesheet for a gate to measure. One copy.
|
||||
*
|
||||
* The stylesheet is GENERATED (build-css.sh concatenates styles/), so a gate must build it and
|
||||
* never measure a stale copy left over from the last run. Three tools said that in three ways and
|
||||
* had already drifted three ways — two used mkdtemp and one a fixed name under a shared /tmp, two
|
||||
* silenced build-css.sh and one did not, and only css-dup passed --dev. The fixed-name variant is
|
||||
* also what once forced a `name` parameter on this API — callers invented 'cascade-export.css'
|
||||
* purely to avoid colliding with each other. mkdtemp makes the name a non-question, so do not
|
||||
* re-add the knob. */
|
||||
import { mkdtempSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
|
||||
export { ROOT } from './root.mjs';
|
||||
import { ROOT } from './root.mjs';
|
||||
|
||||
/* -> absolute path of a freshly built cascade.css. `dev` keeps comments: css-dup matches @mirror
|
||||
* markers, which the squeeze strips. stdio: 'inherit' keeps build-css.sh's "N bytes -> path" line,
|
||||
* which is worth having in a CI log and harmless locally. */
|
||||
export function buildCss({ dev = false } = {}) {
|
||||
const dir = mkdtempSync(join(process.env.RUNNER_TEMP || tmpdir(), 'fs-css-'));
|
||||
const out = join(dir, 'cascade.css');
|
||||
execFileSync(join(ROOT, 'luci-theme-footstrap/build-css.sh'),
|
||||
dev ? [out, '--dev'] : [out], { stdio: 'inherit' });
|
||||
return out;
|
||||
}
|
||||
Reference in new issue
Block a user