chore(vscode-ide-companion): tailwind base

This commit is contained in:
yiliang114
2025-11-23 17:33:10 +08:00
parent 38fd303b07
commit 8ac38aad92
14 changed files with 5333 additions and 604 deletions

View File

@@ -40,11 +40,22 @@ const cssInjectPlugin = {
// Handle CSS files
build.onLoad({ filter: /\.css$/ }, async (args) => {
const fs = await import('fs');
const postcss = (await import('postcss')).default;
const tailwindcss = (await import('tailwindcss')).default;
const autoprefixer = (await import('autoprefixer')).default;
const css = await fs.promises.readFile(args.path, 'utf8');
// Process with PostCSS (Tailwind + Autoprefixer)
const result = await postcss([tailwindcss, autoprefixer]).process(css, {
from: args.path,
to: args.path,
});
return {
contents: `
const style = document.createElement('style');
style.textContent = ${JSON.stringify(css)};
style.textContent = ${JSON.stringify(result.css)};
document.head.appendChild(style);
`,
loader: 'js',