-
-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend PostCSS to use plugins other than autoprefixer #166
Comments
@OngeUK, as of export default function (config, env, helpers) {
let loaderOptionsPlugins = helpers.getPluginsByName(config, 'LoaderOptionsPlugin');
for (let i = 0; i < loaderOptionsPlugins.length; i++) {
let loaderOptionsPlugin = loaderOptionsPlugins[i];
if (loaderOptionsPlugin.options.postcss) {
loaderOptionsPlugin.options.postcss = () => [
//Set your list of postcss plugins here (make sure to add them to your dev dependencies)
]
}
}
} Alternatively, instead of replacing the |
@ethanroday Thanks for the code. However, since Preact CLI already use postcss-loader and postcss-loader has built-in support for |
Removing options.postcss from the default config let me use postcss.config.js files 👍 preact.config.js export default function (config, env, helpers) {
const options = helpers.getPluginsByName(config, 'LoaderOptionsPlugin')
.find(({ plugin }) => plugin.options.options.postcss)
.plugin.options.options;
delete options.postcss; // will use postcss.config.js
} |
Thanks for the feedback - the suggested |
It seems this approach no longer works with preact-cli v2.0.0. :-/ |
And here's the new workaround for preact-cli v2.0.0: export default function (config, env, helpers) {
const postcssLoader = helpers.getLoadersByName(config, 'postcss-loader');
postcssLoader.forEach(({ loader }) => ( delete loader.options ));
} :-) |
Having PostCSS autoprefixer is a really useful feature, but as far as I can tell, autoprefixer is the only PostCSS plugin that can be used.
Would it be possible to extend the PostCSS functionality to enable the use of other plugins, preferably via a
postcss.config.js
file?The text was updated successfully, but these errors were encountered: