@container-queries don't seem to work in blazor #9895
-
What version of Tailwind CSS are you using? What build tool (or framework if it abstracts the build tool) are you using? tried tailwindcli (doesn't find container-queries plugin), and npx (works, but with problem described below) What version of Node.js are you using? 18.12.1x64 What browser are you using? chrome What operating system are you using? win10 Reproduction URL https://play.tailwindcss.com/Szq6nq48mD Describe your issue i want to test the container-queries plugin in blazor. while the code on playground works (see above), it does not in blazor (do note that @ has to be escaped because it is a key symbol in razor markup)
the resulting stylesheet does not contain any @container class.
into my apps stylesheet manually, all is fine. i suspect that because we have to escape the @ symbol by doubling it @@ the parser doesn't generate the css correctly? just a guess? edit: i am a total noob to CSS so please excuse me if i got something wrong here :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This is happening because your content files contain I think something like this would be sufficient: module.exports = {
content: {
files: ['./src/**/*.razor'],
transform: {
// `razor` here is the file extension of your razor view files
razor: (content) => content.replace(/@@/g, "@"),
}
},
// ...
} |
Beta Was this translation helpful? Give feedback.
This is happening because your content files contain
@@
(because you have to escape them). If you copy & paste that code into Tailwind Play you'll see that it's not picked up. The reason for this is Tailwind reads but does not understand your source files. I would suggest using our transformers feature to "unescape" the@
s in your source code.I think something like this would be sufficient: