-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue安装包
66 lines (53 loc) · 1.37 KB
/
vue安装包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
配置lib-flexible + rem
npm install lib-flexible --save
在项目入口文件main.js中添加如下代码,引入flexible
import 'lib-flexible'
npm install px2rem-loader --save-dev
build/utils.js文件里
const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap,
importLoaders: 3 //如果无效可尝试加大
}
}
const px2remloader = {
loader: 'px2rem-loader',
options: {
remUnit: 75 // 设计稿的1/10 我们假设设计稿是750px
}
}
const loaders = options.usePostCSS ? [cssLoader, postcssLoader,px2remloader] : [cssLoader]
在vue-loader.conf文件里
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction,
usePostCSS: true //这个
})
axios
npm i axios
main.js 文件里
Vue.prototype.axios = axios;
sass
npm install --save-dev sass-loader
//sass-loader依赖于node-sass
npm install --save-dev node-sass
webpack.base.conf.js的rules文件里
{
test: /\.sass$/,
loaders: ['style', 'css', 'sass']
}
引用<style lang="scss"></style>
安装sass-resources-loader
npm i sass-resources-loader
修改build里的utils.js文件
将scss: generateLoaders('sass')
改成
scss: generateLoaders('sass').concat(
{
loader: 'sass-resources-loader',
options: {
resources: path.resolve(__dirname, '../src/assets/global.scss') // 需要全局引入的sass路径
}
}
)