feat: SCSS变量导出

This commit is contained in:
郝先瑞
2022-02-24 00:15:46 +08:00
parent 52b34ecab3
commit 81263a4106
3 changed files with 10 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ $--border-color-lighter: #e6ebf5;
$--table-border: 1px solid #dfe6ec; $--table-border: 1px solid #dfe6ec;
$--font-path: "~element-plus/theme-chalk/fonts";
// the :export directive is the magic sauce for webpack // the :export directive is the magic sauce for webpack
// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
:export { :export {

View File

@@ -0,0 +1,6 @@
export interface ScssVariables {
theme: string
}
export const variables: ScssVariables
export default variables

View File

@@ -43,14 +43,14 @@ export default ({command, mode}: ConfigEnv): UserConfig => {
}, },
// SCSS 变量导出 // SCSS 变量导出
// @see https://www.vitejs.net/config/#css-preprocessoroptions // @see https://www.vitejs.net/config/#css-preprocessoroptions
css: { /*css: {
preprocessorOptions: { preprocessorOptions: {
scss: { scss: {
additionalData: `@import "./src/styles/element-variables.scss";`, additionalData: `@import "./src/styles/element-variables.scss";`,
javascriptEnabled: true javascriptEnabled: true
} }
} }
} }*/
} }
) )
} }