mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-26 10:55:57 +00:00
29 lines
773 B
TypeScript
29 lines
773 B
TypeScript
import { mkdir, writeFile } from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
import { Scanner } from '@tailwindcss/oxide';
|
|
|
|
export async function compileInline() {
|
|
await mkdir('css/generated', { recursive: true });
|
|
const scanner = new Scanner({
|
|
sources: [
|
|
{
|
|
base: path.resolve('src'),
|
|
pattern: '{playground,scalar,ui}/**/*.{ts,tsx}',
|
|
negated: false,
|
|
},
|
|
{
|
|
base: path.resolve('src'),
|
|
pattern: 'server/**/*.tsx',
|
|
negated: false,
|
|
},
|
|
],
|
|
});
|
|
await writeFile('css/generated/shared.css', namesToFile(scanner.scan()));
|
|
|
|
console.log('generated CSS files');
|
|
}
|
|
|
|
function namesToFile(names: string[]) {
|
|
return names.map((name) => `@source inline(${JSON.stringify(name)});`).join('\n');
|
|
}
|