Add TailwindCSS as a Stylesheet Format Option in Angular CLI #28801
Labels
area: @schematics/angular
feature: under consideration
Feature request for which voting has completed and the request is now under consideration
feature
Issue that requests a new feature
Command
new
Description
Currently, Angular CLI provides the option to select between various CSS preprocessors like CSS, SCSS, and LESS when creating a new project. However, TailwindCSS, a popular utility-first CSS framework, is not included as an option. With TailwindCSS being increasingly adopted, adding it as a stylesheet option would streamline the setup process for developers who use it with Angular.
Describe the solution you'd like
Add TailwindCSS as an option in the ng new command alongside the existing options (CSS, SCSS, LESS, etc.). This would enable developers to choose TailwindCSS as the default stylesheet framework during project creation, allowing for automatic setup and configuration of Tailwind in the generated project.
Describe alternatives you've considered
Alternatives Considered:
Installing TailwindCSS Manually After Initializing the Project
The current workaround for using TailwindCSS with Angular involves initializing a new project with
ng new
and then following these steps manually:tailwind.config.js
to define the content paths, like so:styles.css
(orstyles.scss
) with Tailwind directives:postcss.config.js
file if not already present to ensure compatibility with Angular's build.While these steps are not overly complex, they add additional configuration overhead, especially for developers who are setting up multiple projects or who are new to Angular or TailwindCSS. This manual process can also introduce errors if configuration steps are missed or misconfigured.
Using a Third-Party TailwindCSS Integration
Some developers have created community guides and packages that streamline the Tailwind setup for Angular, but these are not officially supported and may lack the stability or compatibility assurance that comes with a native CLI integration. Additionally, relying on third-party solutions can introduce maintenance challenges if the third-party solution is no longer actively maintained.
Creating a Custom Schematic for TailwindCSS Setup
Angular allows developers to create custom schematics, which could automate the setup of TailwindCSS after project initialization. However, creating and maintaining a custom schematic requires extra knowledge and effort, and it adds another layer of customization that developers need to maintain across projects. This approach is often impractical for teams who need a simple, standard setup.
Conclusion:
Adding TailwindCSS as an option in the Angular CLI would remove the need for these workarounds, allowing developers to select TailwindCSS during project initialization and have it configured automatically. This native support would reduce setup time, avoid common configuration errors, and enhance the developer experience by aligning Angular with modern CSS practices.
The text was updated successfully, but these errors were encountered: