import type { CSSOptions } from 'vite';

/**
 * css的配置项目
 * @description 如果是导入scss则注入scss的亮色主题
 * @param importCssType - 导入css还是scss
 */
export function cssOption(importCssType: 'css' | 'scss'): CSSOptions {
  const scssImportStr = `
      @use "@/styles/vite/var-colors.scss" as *;
      @use "@/styles/vite/mixin.scss" as *;`;

  return {
    preprocessorOptions: {
      scss: {
        additionalData: importCssType === 'scss' ? scssImportStr : scssImportStr, // scss注入
      },
    },
  };
}
