admin管理员组文章数量:1312907
I have a issue about css pile order in Webpack 2 with vue-cli project.
In main.js, I imported a css library file named skeleton.css
. This include <a>
color style.
import Vue from 'vue'
import App from './App'
import router from './router'
import 'skeleton-css/css/skeleton.css'
In App.vue, I set <a>
color style as below
<style lang="scss">
a {
text-decoration: none;
color: #2c3e50;
}
</style>
When I piled the code and open the chrome inspector. I found the wrong order insert style.
<style type="text/css">....</style> // App.vue inline style
<style type="text/css">....</style> // skeleton.css style
And my webpack 2 config with vue-cli
{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "sass-loader"
}]
}
How should I do to adjust correct import style order?
I have a issue about css pile order in Webpack 2 with vue-cli project.
In main.js, I imported a css library file named skeleton.css
. This include <a>
color style.
import Vue from 'vue'
import App from './App'
import router from './router'
import 'skeleton-css/css/skeleton.css'
In App.vue, I set <a>
color style as below
<style lang="scss">
a {
text-decoration: none;
color: #2c3e50;
}
</style>
When I piled the code and open the chrome inspector. I found the wrong order insert style.
<style type="text/css">....</style> // App.vue inline style
<style type="text/css">....</style> // skeleton.css style
And my webpack 2 config with vue-cli
{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "sass-loader"
}]
}
How should I do to adjust correct import style order?
Share Improve this question edited Apr 26, 2017 at 8:22 R. Oosterholt 8,1203 gold badges56 silver badges78 bronze badges asked Apr 26, 2017 at 8:19 tommychootommychoo 6633 gold badges12 silver badges21 bronze badges 01 Answer
Reset to default 10You need reorder the imports
in your main.js
, since it is the only thing that affects the order of <style>
tags in the resulting DOM:
import 'skeleton-css/css/skeleton.css'
import Vue from 'vue'
import App from './App'
import router from './router'
Now skeleton.css
es first, and everything else would e after it.
本文标签: javascriptHow do I correct the css compile order with webpack in VuejsStack Overflow
版权声明:本文标题:javascript - How do I correct the css compile order with webpack in Vuejs? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741873607a2402337.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论