Replies: 2 comments
-
Also seeking an answer to this question! |
Beta Was this translation helpful? Give feedback.
0 replies
-
At the top of your const plugin = require('tailwindcss/plugin');
const { transformLastClasses } = require('tailwindcss/lib/util/pluginUtils') And in the plugin: [] section of your config add the below code snippet. plugin(function ({ addVariant, config, postcss }) {
addVariant(
'hover-none',
transformLastClasses(
(className) => {
return `hover-none${config('separator')}${className}`
},
{
wrap: () =>
postcss.atRule({
name: 'media',
params: '(hover: none)',
}),
}
),
)
}) This should work as you want with other variants. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi ! 👋
First of all, thanks for your amazing work. I love tailwindcss and this is the best css tool I have seen so far ! I am actually facing a problem trying to write a plugin to add hover and pointer media queries. Here is an example :
The goal of this is to generate this kind of css :
It works well with class like
hover-none:bg-white
, however if I add another variant likehover-none:hover:bg-white
, it does not work. Is there a better way to do this ?Anyoine can help me ?
Note : I saw the classes like
sm:hover:bg-white
works what is strange because behind thesm
it is also a media query. May be it work differently.Beta Was this translation helpful? Give feedback.
All reactions