Skip to content

Commit

Permalink
Merge 6a34874 into fda5f4a
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Sep 17, 2020
2 parents fda5f4a + 6a34874 commit c4f5a23
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
@@ -1,9 +1,9 @@
language: node_js

node_js:
- 'stable'
- 'lts/*'
- 6
- stable
- "12"
- "10"

script: npm run lint && npm t

Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Expand Up @@ -19,5 +19,5 @@ test_script:
environment:
matrix:
- nodejs_version: 'stable'
- nodejs_version: 'lts'
- nodejs_version: '6'
- nodejs_version: '12'
- nodejs_version: '10'
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -24,12 +24,12 @@
"cssnano": "^4.0.0",
"jest": "^24.0.0",
"jsdoc-to-markdown": "^5.0.0",
"postcss": "^7.0.0",
"postcss": "^8.0.5",
"postcss-import": "^12.0.0",
"postcss-nested": "^4.0.0",
"postcss-nested": "^5.0.0",
"standard": "^12.0.0",
"standard-version": "6.0.0",
"sugarss": "^2.0.0"
"sugarss": "^3.0.0"
},
"keywords": [
"postcss",
Expand Down
17 changes: 11 additions & 6 deletions src/plugins.js
Expand Up @@ -56,18 +56,23 @@ const plugins = (config, file) => {

if (plugins.length && plugins.length > 0) {
plugins.forEach((plugin, i) => {
if (plugin.postcss) {
plugin = plugin.postcss
}

if (plugin.default) {
plugin = plugin.default
}

if (plugin.postcss === true) {
plugin = plugin()
} else if (plugin.postcss) {
plugin = plugin.postcss
}

if (
// eslint-disable-next-line
!(typeof plugin === 'object' && Array.isArray(plugin.plugins) ||
typeof plugin === 'function')
!(
(typeof plugin === 'object' && Array.isArray(plugin.plugins)) ||
(typeof plugin === 'object' && plugin.postcssPlugin) ||
(typeof plugin === 'function')
)
) {
throw new TypeError(`Invalid PostCSS Plugin found at: plugins[${i}]\n\n(@${file})`)
}
Expand Down
2 changes: 1 addition & 1 deletion test/js.test.js
Expand Up @@ -85,7 +85,7 @@ describe('postcss.config.js - {Array} - Load Config', () => {

expect(config.plugins.length).toEqual(2)
expect(typeof config.plugins[0]).toBe('function')
expect(typeof config.plugins[1]).toBe('function')
expect(typeof config.plugins[1]).toBe('object')

expect(config.file)
.toEqual(path.resolve('test/js/array', 'postcss.config.js'))
Expand Down

0 comments on commit c4f5a23

Please sign in to comment.