Skip to content

Commit

Permalink
Upgrade PostCSS to 6.0.* (vuejs#176)
Browse files Browse the repository at this point in the history
* Update PostCSS to ^6.0.*

* De-indent package.json

* Undo package.json formatting
  • Loading branch information
Jeff Berry authored and znck committed Mar 18, 2018
1 parent f918a7f commit 31a8c57
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 120 deletions.
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -43,10 +43,10 @@
"magic-string": "^0.22.4",
"merge-options": "^1.0.0",
"parse5": "^3.0.3",
"postcss": "^5.2.11",
"postcss": "^6.0.19",
"postcss-load-config": "^1.2.0",
"postcss-modules": "^0.6.4",
"postcss-selector-parser": "^2.2.3",
"postcss-modules": "^1.1.0",
"postcss-selector-parser": "^3.1.1",
"posthtml": "^0.10.1",
"posthtml-attrs-parser": "^0.1.1",
"rollup-pluginutils": "^2.0.1",
Expand Down Expand Up @@ -83,7 +83,7 @@
"coffeescript-compiler": "^0.1.1",
"less": "^2.7.2",
"node-sass": "^4.5.0",
"pug": "^2.0.0-beta11",
"pug": "^2.0.1",
"stylus": "^0.54.5"
},
"peerDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions src/style/css.js
Expand Up @@ -63,7 +63,9 @@ const addScopeID = postcss.plugin('add-scope-id', ({ scopeID }) => {

return root => {
root.walkRules(rule => {
rule.selector = selectorTransformer.process(rule.selector).result
selectorTransformer.processSync(rule, {
updateSelector: true
})
})
}
})
Expand Down Expand Up @@ -100,7 +102,7 @@ export default async function (promise, options) {
const hasModule = style.module === true
const hasScope = style.scoped === true
const postcssConfig = await postcssLoadConfig(options.postcss)
const plugins = postcssConfig.plugins || []
const plugins = [...postcssConfig.plugins] || []
let processPromise = Promise.resolve()

if (hasScope) {
Expand Down
8 changes: 6 additions & 2 deletions src/vueTransform.js
Expand Up @@ -149,7 +149,7 @@ async function processStyle (styles, id, content, options) {

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

const output = {
let output = {
id,
code: code,
map: map,
Expand All @@ -158,7 +158,11 @@ async function processStyle (styles, id, content, options) {
scoped: 'scoped' in style.attrs
}

outputs.push(options.autoStyles || output.scoped || output.module ? await compile(output, options) : output)
if (options.autoStyles || output.scoped || output.module) {
output = await compile(output, options)
}

outputs.push(output)
}

return outputs
Expand Down

0 comments on commit 31a8c57

Please sign in to comment.