Tailwind does not recognize classes on the angular component tag
See original GitHub issueI have two components called button and text-box and I use sass to style them. To do this, I gave each component a class like the following:
textbox component:
@Component({
selector: 'my-text-box',
template:`<input type="text">`,
host: { class: 'editor-container' },
})
export class MyTextBoxComponent {}
@layer components {
.editor-container {
@apply block bg-white shadow-sm border border-solid border-black;
}
}
button component:
@Component({
selector: 'my-button',
template:`
<button>
Hello
</button>
`,
host: { class: 'my-button' },
})
export class MyButtonComponent implements OnInit {
constructor() {}
ngOnInit(): void {}
}
@layer components {
.my-button {
& > button {
@apply p-5 text-sm relative inline-flex items-center justify-center select-none font-medium whitespace-nowrap overflow-hidden text-ellipsis transition-all bg-blue-600;
}
}
}
The problem arises when the style of my class does not load if the name of the component tag is not the same. For example, I change the "editor-container" class with a “my-text-box”. Everything works fine. (I need this feature to develop components). In fact, if the class name and tag are the same, the style will be added.
Is this a bug? Can I use Customizing extraction logic to set tailwind to check tags in addition to classes?
framework: Angular version 14.0.0 tailwind version: 3.1.4 nodejs version: 16.15.0 browser: Chrome operating system: macOS, Windows
Issue Analytics
- State:
- Created a year ago
- Comments:14
Top Results From Across the Web
Many Tailwind CSS classes doesn´t work on my Angular 12 ...
For some reason, in my styles.scss, I had to import the variables as follows @import 'tailwindcss/base'; @import 'tailwindcss/components'; ...
Read more >Cleaner CSS in your component templates with Tailwind and ...
Headwind is an opinionated Tailwind CSS class sorter for Visual Studio Code. It enforces consistent ordering of classes by parsing your code and ......
Read more >Tailwind CSS - Rapidly build modern websites without ever ...
Rapidly build modern websites without ever leaving your HTML. A utility-first CSS framework packed with classes like flex , pt-4 , text-center and...
Read more >Why React uses className over class attribute
In fact, in earlier times before React 16, if you wrote JSX with an unknown element that does not recognize by React, it...
Read more >How to Add Tailwind CSS to Your Angular Application
With this, Tailwind will process the @tailwind directives and inject its base , components , and utilities classes. 6. Enjoy! You can now...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, Has anyone found a solution?
@asafari72 Would you mind providing a small reproduction repo that I can clone with instructions? I don’t quite understand what the problem is that you’re describing.