refactor(vscode-ide-companion): Refactoring the project structure and updating dependencies

This commit is contained in:
yiliang114
2025-11-29 13:16:58 +08:00
parent 9ae45c01a6
commit 6885138cf0
13 changed files with 84 additions and 183 deletions

View File

@@ -88,38 +88,6 @@ const cssInjectPlugin = {
loader: 'js',
};
});
// Handle SCSS files
build.onLoad({ filter: /\.scss$/ }, async (args) => {
const sass = await import('sass');
const postcss = (await import('postcss')).default;
const tailwindcss = (await import('tailwindcss')).default;
const autoprefixer = (await import('autoprefixer')).default;
// Compile SCSS to CSS
const sassResult = sass.compile(args.path, {
loadPaths: [args.path.substring(0, args.path.lastIndexOf('/'))],
});
// Process with PostCSS (Tailwind + Autoprefixer)
const postcssResult = await postcss([tailwindcss, autoprefixer]).process(
sassResult.css,
{
from: args.path,
to: args.path,
},
);
const css = postcssResult.css;
return {
contents: `
const style = document.createElement('style');
style.textContent = ${JSON.stringify(css)};
document.head.appendChild(style);
`,
loader: 'js',
};
});
},
};