question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support PostCSS plugins

See original GitHub issue

How to use additional PostCSS plugins like tailwindcss?

plugins: () => [
    require('postcss-flexbugs-fixes'),
    require('postcss-preset-env')({
        autoprefixer: {
            flexbox: 'no-2009',
        },
        stage: 3,
    }),
 ],

Can we extends this to use some other plugins?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
pavinthancommented, Nov 18, 2018

@patricklafrance Thank you for your great reply It’s really helps, but I don’t like to overrider CRA, just like use CRA as CRA.

and Tailwind CSS becomes most popular utility-first CSS framework seems 22,833 weekly downloads ( ref: https://www.npmjs.com/package/tailwindcss ) so my suggestion CRA users use Tailwind CSS without extending or customize CRA.

CRA can apply postcss tailwindcss plugin only tailwind.js ( recommenced config file from https://tailwindcss.com/docs/installation#2-create-a-tailwind-config-file ) in root directory

@gaearon may you please have a look and advice on this please? 🙏

3reactions
patricklafrancecommented, Nov 18, 2018

Hi @pavinthan,

CRA doesn’t support this use case.

The official recommendation from CRA is to make your own fork and customize PostCSS to your needs.

You can find the documentation here: https://facebook.github.io/create-react-app/docs/alternatives-to-ejecting#docsNav

As an alternative to create a fork, you could use craco and follow this recipe to extends the PostCSS plugins.

As @Timer mentioned in other issues, using craco is very prone to breaking since it’s an hacky layer on top of CRA to make it more configurable.

That begin said, at Sharegate all our new apps use CRA + craco and they all extends the PostCSS config to add additional CSS features and PostCSS plugins.

This means that you can be confident that if CRA introduce a change that breaks how craco makes PostCSS configurable we will try to fix it as soon as possible.

Hope it helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

postcss/plugins.md at main - GitHub
postcss -custom-properties supports variables, using syntax from the W3C Custom Properties. postcss-custom-selectors adds custom aliases for selectors. postcss- ...
Read more >
What is PostCSS? How to Use Plugins to Automate CSS Tasks
One of the basic and most important plugins to use is postcss-import. It lets us import CSS files into other files. To check...
Read more >
PostCSS - IntelliJ IDEs Plugin - JetBrains Marketplace
Brings support for PostCSS: The IDE now recognises .pcss files. You can also enable PostCSS support for your .css files in Preferences |...
Read more >
PostCSS Language Support - Visual Studio Marketplace
Open the command palette and select Extensions: Install Extensions; Search for PostCSS Language Support; Click Install ...
Read more >
So you want to make a PostCSS plugin - CSS-Tricks
PostCSS plugins should be created to do one particular thing; it can be as simple as adding a :focus selector to every :hover...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found