Skip to content

PostCSS config #171

Closed
Closed
@timarney

Description

@timarney

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

gaearon commented on Jul 25, 2016

@gaearon
Contributor

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

timarney commented on Jul 26, 2016

@timarney
Author

@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

gaearon commented on Jul 26, 2016

@gaearon
Contributor

You can find some discussion on this in #78.

mihhail-lapushkin

mihhail-lapushkin commented on May 22, 2017

@mihhail-lapushkin

A possible solution from my side:
#2032 (comment)

locked and limited conversation to collaborators on Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @timarney@gaearon@mihhail-lapushkin

        Issue actions

          PostCSS config · Issue #171 · facebook/create-react-app