theme sheet order

This commit is contained in:
robert dennis
2026-10-12 21:20:14 -04:00
parent 18e6c81b32
commit 88be3161db
10 changed files with 55 additions and 166 deletions
+4 -12
View File
@@ -1,9 +1,7 @@
// Writes every Tailwind class candidate in the panel's markup to packages/sdk/core-classes.txt,
// which a theme stylesheet sources so it can replace the panel's, and the list's hash beside
// the build, where Blade compares it with a theme's dist/theme.json.
// Writes every Tailwind class candidate in the panel's markup to packages/sdk/core-classes.txt, which
// theme-entry.css sources so a theme's Tailwind build orders its utilities with the panel's.
import { Scanner } from '@tailwindcss/oxide';
import { createHash } from 'node:crypto';
import { mkdirSync, writeFileSync } from 'node:fs';
import { writeFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
const root = fileURLToPath(new URL('..', import.meta.url));
@@ -13,11 +11,5 @@ const scanner = new Scanner({
{ base: `${root}resources/views`, pattern: '**/*.blade.php', negated: false },
],
});
const contents = `${[...new Set(scanner.scan())].sort().join('\n')}\n`;
writeFileSync(`${root}packages/sdk/core-classes.txt`, contents);
mkdirSync(`${root}public/assets`, { recursive: true });
writeFileSync(
`${root}public/assets/core-classes.json`,
`${JSON.stringify({ hash: createHash('sha256').update(contents).digest('hex').slice(0, 16) })}\n`
);
writeFileSync(`${root}packages/sdk/core-classes.txt`, `${[...new Set(scanner.scan())].sort().join('\n')}\n`);