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.

Specify custom PostCSS plugins

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions.

@angular/cli: 1.4.9 node: 6.11.4 os: linux x64 @angular/animations: 4.4.6 @angular/common: 4.4.6 @angular/compiler: 4.4.6 @angular/core: 4.4.6 @angular/forms: 4.4.6 @angular/http: 4.4.6 @angular/platform-browser: 4.4.6 @angular/platform-browser-dynamic: 4.4.6 @angular/router: 4.4.6 @angular/cli: 1.4.9 @angular/compiler-cli: 4.4.6 @angular/language-service: 4.4.6 typescript: 2.3.4

Desired functionality.

I would like the ability to specify custom postCss plugins, without having to eject the angular webpack.config.js file.

Mention any other details that might be useful.

This would enable frameworks like TailwindCSS (https://tailwindcss.com) and other useful PostCSS plugins through the CLI without having to deal with the ejected webpack config file.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:145
  • Comments:51 (9 by maintainers)

github_iconTop GitHub Comments

55reactions
kyliaucommented, Feb 4, 2021

Based on the survey results, 90% of the participants wanted Tailwind CSS, and 37% wanted Purge CSS. The signal was loud and clear, so we have added Tailwind support in #19935, and it’ll be released in v11.2 scheduled for Feb 10, 2021.

As for PurgeCSS, supporting it is somewhat tricky due to the risk of breaking applications. After some thorough discussion with the Angular Components team, we think it is best to separate the problem space into first-party code and third-party code. For first-party code, since developers know their own code best, it is better that CLI provide a checker to detect unused CSS, and let developers decide if they want to remove (more importantly, whether it is safe to remove) the CSS themselves. This applies to both component stylesheets and global stylesheets. For third-party code, removing unused CSS is necessary in some libraries that do not provide fine grained stylesheets. However, this can be done post-build, and does not necessarily require integration with CLI. We are working on this, and will publish some guides / examples soon.

We maintain our stance that exposing PostCSS configuration is not a scalable solution in the long term, as explained in https://github.com/angular/angular-cli/issues/8427#issuecomment-576234801. Going forward, while we are not able to support every PostCSS plugin out there, we will continue to review different use cases on an individual basis, and make decision based on developer feedback and the current landscape of web development. Please open a new issue if there’s a specific plugin you’d like CLI to support. I’ll close this issue for now, thank you all for the feedback!

Screen Shot 2021-02-04 at 9 15 47 AM
36reactions
GuerrillaCodercommented, Aug 23, 2020

Any progress update on this feature? Almost 3 years since it was suggested. I am dropping SASS and going PostCSS. Right now it looks like I will have to switch to React to do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

postcss/writing-a-plugin.md at main - GitHub
Writing a PostCSS Plugin ; Create a new file in postcss/ folder with the name of your plugin. Copy plugin template from our...
Read more >
Custom PostCSS Plugins - CodeKit
Custom PostCSS Plugins ; First, open the Packages ; For projects that already have a package.json ; Create a file named postcss.config.js ;...
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 >
Writing Your First PostCSS Plugin - DockYard
PostCSS turns your CSS file into a JS object. · PostCSS plugins can loop through the object and add/remove/modify selectors and properties.
Read more >
PostCSS Plugin Guidelines
A PostCSS plugin is a function that receives and, usually, transforms a CSS AST from the PostCSS parser. The rules below are mandatory...
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