Skip to content

Commit d55a9c4

Browse files
author
liaofeiyin
committed
add sass-resources-loader
1 parent 0d17ffb commit d55a9c4

File tree

7 files changed

+35
-6
lines changed

7 files changed

+35
-6
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"eslint-plugin-vue": "^5.0.0",
2727
"node-sass": "^4.9.0",
2828
"sass-loader": "^7.1.0",
29+
"sass-resources-loader": "^2.0.0",
2930
"typescript": "~3.2.2",
3031
"vue-template-compiler": "^2.5.21"
3132
}

src/app/scss/_colors.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// 前景色使用 a-颜色名(如果与其他组件同名,则使用 a-fg-颜色名)
22
// 背景色使用 a-bg-颜色名
3-
@import "vars";
43

54
.a-bg-primary {
65
background-color: $color-primary;

src/app/scss/_text.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@import "vars";
21

32
html {
43
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "PingFangSC",

src/app/scss/_vars.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
$_: 1rem/20;
1+
//$_: 1rem/20;
2+
$_: 1px;
3+
$px: $_;
24

35
$weight-map: (
46
ultralight: 100,

src/views/home/home.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div @click="tapPrint">打印</div>
66

77
<div ref="page1" class="fx-row" style="page-break-after: always">
8-
<div class="border">第一页打印内容</div>
8+
<div class="border a-text-20">第一页打印内容</div>
99
<div>第一页打印内容</div>
1010
<div>第一页打印内容</div>
1111
<div>第一页打印内容</div>
@@ -137,6 +137,6 @@ export default Vue.extend({
137137

138138
<style lang="scss">
139139
.border {
140-
border: 1px solid #ccc;
140+
border: 1*$px solid #ccc;
141141
}
142142
</style>

vue.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ module.exports = {
77
},
88
},
99

10+
chainWebpack: config => {
11+
const oneOfsMap = config.module.rule('scss').oneOfs.store
12+
oneOfsMap.forEach(item => {
13+
item
14+
.use('sass-resources-loader')
15+
.loader('sass-resources-loader')
16+
.options({
17+
resources: './src/app/scss/_vars.scss'
18+
})
19+
.end()
20+
})
21+
},
22+
1023
// pages: {
1124
// about: {
1225
// entry: 'src/views/about-main.js',

yarn.lock

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,12 @@ async@^1.5.2:
12931293
version "1.5.2"
12941294
resolved "http://registry.npm.taobao.org/async/download/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
12951295

1296+
async@^2.1.4:
1297+
version "2.6.2"
1298+
resolved "https://registry.yarnpkg.com/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381"
1299+
dependencies:
1300+
lodash "^4.17.11"
1301+
12961302
asynckit@^0.4.0:
12971303
version "0.4.0"
12981304
resolved "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
@@ -4319,7 +4325,7 @@ loader-utils@^0.2.16:
43194325
json5 "^0.5.0"
43204326
object-assign "^4.0.1"
43214327

4322-
loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0:
4328+
loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.0.4, loader-utils@^1.1.0:
43234329
version "1.2.3"
43244330
resolved "http://registry.npm.taobao.org/loader-utils/download/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7"
43254331
dependencies:
@@ -6149,6 +6155,15 @@ sass-loader@^7.1.0:
61496155
pify "^3.0.0"
61506156
semver "^5.5.0"
61516157

6158+
sass-resources-loader@^2.0.0:
6159+
version "2.0.0"
6160+
resolved "https://registry.yarnpkg.com/sass-resources-loader/-/sass-resources-loader-2.0.0.tgz#88569c542fbf1f18f33a6578b77cc5b36c56911d"
6161+
dependencies:
6162+
async "^2.1.4"
6163+
chalk "^1.1.3"
6164+
glob "^7.1.1"
6165+
loader-utils "^1.0.4"
6166+
61526167
sax@^1.2.4, sax@~1.2.4:
61536168
version "1.2.4"
61546169
resolved "http://registry.npm.taobao.org/sax/download/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"

0 commit comments

Comments
 (0)