Skip to content

Commit

Permalink
fix: PostCSS 8 plugin loading
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Oct 2, 2020
1 parent 4b44e01 commit e1b82fe
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 34 deletions.
45 changes: 15 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@
"memfs": "^3.2.0",
"midas": "^2.0.3",
"npm-run-all": "^4.1.5",
"postcss": "^8.0.1",
"postcss": "^8.1.1",
"postcss-dark-theme-class": "^0.4.0",
"postcss-import": "^12.0.1",
"postcss-js": "^2.0.0",
"postcss-nested": "^4.2.3",
"postcss-nested": "^5.0.1",
"postcss-short": "^5.0.0",
"prettier": "^2.1.1",
"sass": "^1.26.10",
Expand Down
2 changes: 2 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ function pluginFactory() {
const [name, options] = plugin;

listOfPlugins.set(name, options);
} else if (plugin && typeof plugin === 'function') {
listOfPlugins.set(plugin);
} else if (
plugin &&
Object.keys(plugin).length === 1 &&
Expand Down
2 changes: 1 addition & 1 deletion test/config-autoload.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('autoload config', () => {
expect(loadedConfig.config.to).toEqual(
'./test/fixtures/config-autoload/js/object/expect/index.css'
);
expect(Object.keys(loadedConfig.config.plugins).length).toEqual(2);
expect(Object.keys(loadedConfig.config.plugins).length).toEqual(4);
expect(loadedConfig.filepath).toEqual(
path.resolve(testDirectory, 'js/array', 'postcss.config.js')
);
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/config-autoload/js/array/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ module.exports = function (api) {
{
// Options
}
]
],
require('postcss-nested'),
require('postcss-nested')({ /* Options */ }),
]
}
};

0 comments on commit e1b82fe

Please sign in to comment.