Skip to content

Commit d023617

Browse files
committed
use postcss fixed #9
1 parent c3be79d commit d023617

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"vue": "^2.2.6"
1313
},
1414
"devDependencies": {
15+
"autoprefixer": "^6.7.7",
1516
"babel-core": "^6.24.1",
1617
"babel-loader": "^6.4.1",
1718
"babel-preset-es2015": "^6.24.1",
@@ -25,6 +26,7 @@
2526
"glob": "^7.1.1",
2627
"html-loader": "^0.4.5",
2728
"html-webpack-plugin": "^2.28.0",
29+
"postcss-loader": "^1.3.3",
2830
"style-loader": "^0.16.1",
2931
"url-loader": "^0.5.8",
3032
"vue-loader": "^11.3.4",

postcss.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
plugins: [
3+
require('autoprefixer')()
4+
]
5+
}

src/pages/user/index/app.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<div id="app">
3+
<h1>Use PostCSS</h1>
34
<modal></modal>
45
<div class="dd">
56
Index
@@ -36,8 +37,13 @@ export default {
3637
}
3738
</script>
3839

39-
<style>
40+
<style lang="postcss">
4041
body {
4142
background-color: #f5f5f5;
4243
}
44+
:root h1 {
45+
--color: red;
46+
display: flex;
47+
color: var(--color);
48+
}
4349
</style>

webpack.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ const config = {
3939
css: ExtractTextPlugin.extract({
4040
use: 'css-loader',
4141
fallback: 'style-loader'
42+
}),
43+
postcss: ExtractTextPlugin.extract({
44+
use: ['css-loader', 'postcss-loader'],
45+
fallback: 'style-loader'
4246
})
4347
}
4448
}
@@ -51,8 +55,8 @@ const config = {
5155
{
5256
test: /\.css$/,
5357
use: ExtractTextPlugin.extract({
54-
fallback: 'style-loader',
55-
use: 'css-loader'
58+
use: ['css-loader', 'postcss-loader'],
59+
fallback: 'style-loader'
5660
})
5761
},
5862
{

0 commit comments

Comments
 (0)