-
-
Notifications
You must be signed in to change notification settings - Fork 208
Closed
Description
The way it's currently handled is non intuitive https://github.com/postcss/postcss-loader/blob/a9cb6997eec444b4f90edd67ac7ec4b5d944cbb1/index.js#L28
What about replacing that .call(this) by just calling it with an argument?
Then in the configuration you can instead show a more clear code like
postcss: function (webpack) {
return [
postcssImport({
// see postcss-import docs to learn about onImport callback
// https://github.com/postcss/postcss-import
onImport: function (files) {
files.forEach(webpack.addDependency);
}.bind(webpack)
})
];
}Also fyi, I plan to add a addDependencyTo option to postcss-import in order to be able to write even more simpler and clean boilerplate like
postcss: function (webpack) {
return [
postcssImport({
addDependencyTo: webpack
})
];
}What do you think?
Note: to avoid a breaking change, we might start by changing the doc + allow context and argument at the same time (via .call(this, this)), then in a later major release we replace .call(this, this) by (this).
Metadata
Metadata
Assignees
Labels
No labels