Skip to content

Commit 31a8c57

Browse files
Jeff Berryznck
Jeff Berry
authored andcommitted
Upgrade PostCSS to 6.0.* (vuejs#176)
* Update PostCSS to ^6.0.* * De-indent package.json * Undo package.json formatting
1 parent f918a7f commit 31a8c57

File tree

4 files changed

+155
-120
lines changed

4 files changed

+155
-120
lines changed

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
"magic-string": "^0.22.4",
4444
"merge-options": "^1.0.0",
4545
"parse5": "^3.0.3",
46-
"postcss": "^5.2.11",
46+
"postcss": "^6.0.19",
4747
"postcss-load-config": "^1.2.0",
48-
"postcss-modules": "^0.6.4",
49-
"postcss-selector-parser": "^2.2.3",
48+
"postcss-modules": "^1.1.0",
49+
"postcss-selector-parser": "^3.1.1",
5050
"posthtml": "^0.10.1",
5151
"posthtml-attrs-parser": "^0.1.1",
5252
"rollup-pluginutils": "^2.0.1",
@@ -83,7 +83,7 @@
8383
"coffeescript-compiler": "^0.1.1",
8484
"less": "^2.7.2",
8585
"node-sass": "^4.5.0",
86-
"pug": "^2.0.0-beta11",
86+
"pug": "^2.0.1",
8787
"stylus": "^0.54.5"
8888
},
8989
"peerDependencies": {

src/style/css.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ const addScopeID = postcss.plugin('add-scope-id', ({ scopeID }) => {
6363

6464
return root => {
6565
root.walkRules(rule => {
66-
rule.selector = selectorTransformer.process(rule.selector).result
66+
selectorTransformer.processSync(rule, {
67+
updateSelector: true
68+
})
6769
})
6870
}
6971
})
@@ -100,7 +102,7 @@ export default async function (promise, options) {
100102
const hasModule = style.module === true
101103
const hasScope = style.scoped === true
102104
const postcssConfig = await postcssLoadConfig(options.postcss)
103-
const plugins = postcssConfig.plugins || []
105+
const plugins = [...postcssConfig.plugins] || []
104106
let processPromise = Promise.resolve()
105107

106108
if (hasScope) {

src/vueTransform.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ async function processStyle (styles, id, content, options) {
149149

150150
const map = (new MagicString(code)).generateMap({ hires: true })
151151

152-
const output = {
152+
let output = {
153153
id,
154154
code: code,
155155
map: map,
@@ -158,7 +158,11 @@ async function processStyle (styles, id, content, options) {
158158
scoped: 'scoped' in style.attrs
159159
}
160160

161-
outputs.push(options.autoStyles || output.scoped || output.module ? await compile(output, options) : output)
161+
if (options.autoStyles || output.scoped || output.module) {
162+
output = await compile(output, options)
163+
}
164+
165+
outputs.push(output)
162166
}
163167

164168
return outputs

0 commit comments

Comments
 (0)