Skip to content

Commit

Permalink
Add PostCSS 8 plugin error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Sep 16, 2020
1 parent 69869c6 commit ce95376
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/processor.es6
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ class Processor {
normalize (plugins) {
let normalized = []
for (let i of plugins) {
if (i.postcss === true) {
let plugin = i()
throw new Error(
'PostCSS plugin ' + plugin.postcssPlugin +
' requires PostCSS 8. Update PostCSS or downgrade this plugin.'
)
}

if (i.postcss) i = i.postcss

if (typeof i === 'object' && Array.isArray(i.plugins)) {
Expand All @@ -126,6 +134,11 @@ class Processor {
'in your PostCSS runner documentation.'
)
}
} else if (typeof i === 'object' && i.postcssPlugin) {
throw new Error(
'PostCSS plugin ' + i.postcssPlugin +
' requires PostCSS 8. Update PostCSS or downgrade this plugin.'
)
} else {
throw new Error(i + ' is not a PostCSS plugin')
}
Expand Down

0 comments on commit ce95376

Please sign in to comment.