Creating a Tailwind component
Tailwind is a very popular CSS framework that enforces a utility-first core principle. It contains classes and styles that can be used in Angular applications to create easily composable user interfaces.
We will use the schematics API of the Angular CLI to build a generation schematic for Angular components. The schematic will generate a new Angular component that is styled with a Tailwind container layout.
Important note
The schematic that we will build does not need to have Tailwind CSS installed by default. However, the application in which we will use the schematic does require it.
Let's see how we can accomplish that:
- Execute the following schematics CLI command to add a new schematic to our collection:
schematics blank tailwind-container
The preceding command will update the
collection.json
file to contain a new entry for thetailwind-container
schematic. It will also create atailwind-container
folder in thesrc
folder of...