Closed
Description
It would be nice to be able modify or add PostCss plugins.
If there was a css config file that could be modified that sits in the src directory it could be required in the Webpack config and allow additional functionality (without ejecting) but still keep to the goals of this project.
Roughly this:
Modified Webpack config
var path = require('path');
var cssConfig = require('../src/css.config')
var webpack = require('webpack');
...
},
postcss: function() {
return cssConfig;
},
plugins: [
new HtmlWebpackPlugin({
By default autoprefixer would be the only plugin in the file after running (create-react-app my-app).
Default css.config.js
var autoprefixer = require('autoprefixer')
module.exports = [autoprefixer]
User could add plugins as desired:
customized css.config.js
var autoprefixer = require('autoprefixer')
var postcssnested = require('postcss-nested')
module.exports = [postcssnested, autoprefixer]
I think a setup something like this would allow users to use SASS, LESS etc...
Activity
gaearon commentedon Jul 25, 2016
Hi, thanks for the suggestion.
We are not currently planning to add the ability to configure anything.
Instead, we are looking for good defaults.
There is some explanation about this in #99.
timarney commentedon Jul 26, 2016
@gaearon I understand, I'm all for the good defaults. I love the idea of keeping it simple and the eject option is great (was so happy to see that).
I guess what I'm stuck on is, if I want to add 1 plugin (i.e. https://github.com/jonathantneal/precss to give me SASS like markup ) or any of the other 200+ plugins PostCSS has, I have to eject to get it. I would rather not opt out of all the benefits one dependency etc... to make a small addon.
Good defaults but some hooks, middleware or how about a reducer ;)
The WordPress hook style is great because it's a quick install (easy for any type of user ) - but as a developer I can tweak so many things without touching the core ... and my tweaks don't opt me out of quick upgrades.
Anyway some thoughts for another version perhaps.
PS - Thanks for Redux. It's changed the way I code.
gaearon commentedon Jul 26, 2016
You can find some discussion on this in #78.
mihhail-lapushkin commentedon May 22, 2017
A possible solution from my side:
#2032 (comment)