mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(skin): add audio skins for HTML and React presets (#772)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
038ad8b4f5
commit
d751fdabea
@@ -0,0 +1,31 @@
|
||||
import { globSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { resolveImports } from './resolve-css-imports.mjs';
|
||||
|
||||
/**
|
||||
* @param {{ skinsDir: string; outDir: string }} options
|
||||
*/
|
||||
export function copyCssPlugin(options) {
|
||||
const { skinsDir, outDir } = options;
|
||||
|
||||
return {
|
||||
name: 'copy-css',
|
||||
buildStart() {
|
||||
for (const file of globSync('src/**/*.css')) {
|
||||
this.addWatchFile(file);
|
||||
}
|
||||
for (const file of globSync(join(skinsDir, '**/*.css'))) {
|
||||
this.addWatchFile(file);
|
||||
}
|
||||
},
|
||||
writeBundle() {
|
||||
for (const file of globSync('src/**/*.css')) {
|
||||
const content = readFileSync(file, 'utf-8');
|
||||
const resolved = resolveImports(content, dirname(file), skinsDir);
|
||||
const outFile = join(outDir, file.replace(/^src\//, ''));
|
||||
mkdirSync(dirname(outFile), { recursive: true });
|
||||
writeFileSync(outFile, resolved);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user