windicss CLI ignores inline styles with `@apply`
See original GitHub issueTry compiling the following HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bare</title>
<link rel="stylesheet" type="text/css"href="out.css">
<style>
.btn-blue {
@apply bg-blue-500 hover:bg-blue-700 text-white;
padding-top: 1rem;
}
</style>
</head>
<body>
<p class="font-bold mx-auto bg-purple-200 border-2 p-3 w-1/2">I'm new</p>
<a class="border-2 border-black border-opacity-50 border-dashed">hey</a>
<button class="btn-blue">click</button>
</body>
</html>
windicss will ignore the btn-blue
class, when I was expecting it to process the @apply
directives in the script block. Is this a bug, or simply a feature that was never implemented?
./node_modules/.bin/windicss index.html
matched files: [ 'index.html' ]
output file: windi.output.css
ignored classes: [ 'btn-blue' ]
windi.output.css
.bg-purple-200 { --tw-bg-opacity: 1; background-color: rgba(221, 214, 254, var(--tw-bg-opacity)); } .border-black { --tw-border-opacity: 1; border-color: rgba(0, 0, 0, var(--tw-border-opacity)); } .border-opacity-50 { --tw-border-opacity: 0.5; } .border-dashed { border-style: dashed; } .border-2 { border-width: 2px; } .font-bold { font-weight: 700; } .mx-auto { margin-left: auto; margin-right: auto; } .p-3 { padding: 0.75rem; } .w-1\/2 { width: 50%; }
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Windi CSS CLI
Generate css from text files that containing windi classes. By default, it will use interpretation mode to generate a single css file.
Read more >Integration for Svelte | Windi CSS
By default, all inline used classes of Windi CSS will be scoped with native svelte logic. This has its advantages (you can find...
Read more >WindiCSS v2.2 is here | Windi CSS
Next generation utility-first CSS framework. ... Support Config File When using CLI ... You can block any utility you don't want to use...
Read more >Directives - Windi CSS
Use @apply to inline any existing utility classes into your style block. This is useful when you find a common utility pattern in...
Read more >Just-in-Time Mode - Tailwind CSS
Use inline styles for these situations, or combine Tailwind with a CSS-in-JS library like Emotion if it makes sense for your project.
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 Free
Top 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
Related concern: you can’t use
@apply
in good ol’.css
files, and have windi’s cli convert it? https://github.com/windicss/windicss/issues/102#issuecomment-807926266https://github.com/windicss/windicss/commit/7895fe2a935418e0ad3de4776d7a1f46cb9029a8 support style block. using it like bellow.