Skip to content
This repository was archived by the owner on May 12, 2020. It is now read-only.

Commit 35a35cd

Browse files
committed
feat(sass): set global sass variables
1 parent c5f8982 commit 35a35cd

5 files changed

Lines changed: 90 additions & 0 deletions

File tree

src/style/theme/index.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* More Detail: https://element.eleme.cn/#/en-US/component/custom-theme#update-scss-variables-in-your-project
3+
*/
4+
5+
@import './variables.scss';
6+
@import './mixins.scss';

src/style/theme/mixins.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@mixin text-dot {
2+
overflow: hidden;
3+
white-space: nowrap;
4+
text-overflow: ellipsis;
5+
}
6+
7+
@mixin normalize-link($s: 14px, $w: 500, $c: rgba(0, 0, 0, 0.85), $h: #1890ff) {
8+
font-size: $s;
9+
font-weight: $w;
10+
color: $c;
11+
text-decoration: none;
12+
13+
&:hover {
14+
color: $h;
15+
}
16+
}
17+
18+
@mixin flex-center {
19+
display: flex;
20+
justify-content: center;
21+
align-items: center;
22+
flex-direction: column;
23+
}

src/style/theme/ui.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@import './variables.scss';
2+
3+
/* Override theme color variables */
4+
$--color-primary: $main-light;
5+
6+
/* Reqiured. override icon font path varibale */
7+
$--font-path: '~element-ui/lib/theme-chalk/fonts';
8+
9+
@import '~element-ui/packages/theme-chalk/src/index';

src/style/theme/variables.scss

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* Import these color variables via sass-loader options
3+
* more detail: https://github.com/webpack-contrib/sass-loader#environment-variables
4+
*/
5+
6+
// main color
7+
$main-light: #72beff;
8+
$main-dark: #282c34;
9+
$main-selected: #49597a;
10+
$main-hover: #49597a;
11+
$main-white: #ffffff;
12+
$main-bg: #ebf0f1;
13+
14+
// sub color
15+
$sub-yellow: #ffd75c;
16+
$sub-green: #5adc9c;
17+
$sub-red: #ff7977;
18+
$sub-line: #eeeeee;
19+
$sub-table-bg: #f9fafc;
20+
$sub-selected: #eff7fc;
21+
$sub-border: #cccccc;
22+
23+
// font color
24+
$font-title: #3b4966;
25+
$font-selected: #72beff;
26+
$font-1: #333333;
27+
$font-2: #6d6d6d;
28+
$font-3: #999999;
29+
$font-tips: #c0c4cc;
30+
$font-white: #ffffff;
31+
$font-warn: #ff7977;
32+
33+
// font size
34+
$fz-title: 22px;
35+
$fz-subtitle: 18px;
36+
$fz-label: $fz-subtitle;
37+
$fz-subtitle-s: 16px;
38+
$fz-content: 14px;
39+
40+
// shadow
41+
$box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);

vue.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ module.exports = {
5858
// https://webpack.js.org/configuration/optimization/#optimizationruntimechunk
5959
chainConfig.optimization.runtimeChunk('single')
6060
})
61+
},
62+
css: {
63+
loaderOptions: {
64+
/**
65+
* @description Set global sass environment variables
66+
* https://github.com/webpack-contrib/sass-loader#environment-variables
67+
*/
68+
sass: {
69+
data: `@import "STYLE/theme/index.scss";`
70+
}
71+
}
6172
}
6273
}
6374

0 commit comments

Comments
 (0)