Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Upgrade PostCSS to 6.0.* #176

Merged
merged 3 commits into from
Mar 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading