How to preload variables in a component style

霸气de小男生 提交于 2019-12-25 00:54:54

问题


So I successfully configure webpack for loading scss style that is in my components. I use a <style lang="scss"></style> and it goes well.
I used the vue-cli with the webpack installation.
But I would need to call some of my scss variables from there, so I guess I would need a kind of preload?

Is there a way to do it without having to @import in each component?


回答1:


You need sass-resources-loader.
The solution is provided in vue-loader's official document. Please check the section named Loading a global settings file.

PS: Actually, it's been discussed as an issue for quite a while. You can check the discussion here.



来源:https://stackoverflow.com/questions/45544300/how-to-preload-variables-in-a-component-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!