我问的是scss文件,不是vue和js文件。
刚开始我把样式都放在同一个style.scss,里面import了一个较大的big.scss
//style.scss
@import 'big.scss'
.other{...}
然后在多处使用这个style.scss,发现打出来的css文件超级大。
把big.scss拿掉,就发现打出来的css文件小了好多。
//style.scss
.other{...}
----------------------------------2019.1.14------------------------------------
加上scoped属性的样式都有一个类似data-v-0a679ea0的标识属性,所以导致css重复打包了。
A.vue
<style lang="scss" scoped>
@import '../common.scss';
</style>
B.vue
<style lang="scss" scoped>
@import '../common.scss';
</style>
然后想,那我把公共部分的css代码不写在scoped里面不就好了
<style lang="scss">
@import '../common.scss';
</style>
<style lang="scss" scoped>
@import '../common.scss';
.input-container{
color:$grey
}
运行报错: Undefined variable: "$grey"
不用scoped,之前的类名什么的有一些重复了,然后样式就乱了
感觉这个是个大大的bug,无解。
https://lry1994.github.io/stu...
找到一个方法