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:
Sam Potts
2026-03-09 12:12:49 +11:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 038ad8b4f5
commit d751fdabea
125 changed files with 4174 additions and 2264 deletions
+27
View File
@@ -0,0 +1,27 @@
import { readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
/**
* Resolves `@import` directives in CSS content, inlining referenced files.
*
* @param {string} content - The CSS content to resolve.
* @param {string} baseDir - The directory to resolve relative imports from.
* @param {string} skinsDir - The directory to resolve `@videojs/skins` imports from.
* @returns {string} The resolved CSS content.
*/
export function resolveImports(content, baseDir, skinsDir) {
return content.replace(/@import\s+['"]([^'"]+)['"]\s*;/g, (_, importPath) => {
let file;
if (importPath.startsWith('@videojs/skins/')) {
file = resolve(skinsDir, importPath.replace('@videojs/skins/', ''));
} else if (importPath.startsWith('.')) {
file = resolve(baseDir, importPath);
} else {
return _;
}
const nested = readFileSync(file, 'utf-8');
return resolveImports(nested, dirname(file), skinsDir);
});
}