Comments (8)
Yep, I get this. We struggled with choosing what utilities to add hover states to. Ideally we would just add it to them all (like the responsive ones), but practically this doesn't work well since it would create a TON of classes and bloat the CSS filesize.
We're planning to make it possible in the future to choose which utilities have hover states and which ones do not. That should take care of this for you.
from tailwindcss.
The ideal would be to filter out the unused utilities, but that is a whole different story, with it's own drawbacks. (there are tools that can do this, but detecting usage within javascript is tricky).
As a quick note, I've tried purifycss for this in the past and while it is surprisingly good at detecting classes across PHP, HTML, JS, etc., it has some annoying bugs where it won't remove classes that end in numbers or contain non-standard characters:
purifycss/purifycss#147 (comment)
from tailwindcss.
Ideally we would just add it to them all (like the responsive ones)
It would be cool if we can black- or whitelist utilities for both the hover states and responsive stuff.
Having all utilities be responsive also bloats the final css, while practically you won't need all of these. So being able to control this in some way would be very nice!
from tailwindcss.
That sounds like a good solution, and I can understand that adding a bunch of utilities is not ideal.
The ideal would be to filter out the unused utilities, but that is a whole different story, with it's own drawbacks. (there are tools that can do this, but detecting usage within javascript is tricky).
from tailwindcss.
For sure, and you're welcome to use one of those plugins in your build process, you just need to be aware of the limitations.
from tailwindcss.
The ideal would be to filter out the unused utilities, but that is a whole different story, with it's own drawbacks. (there are tools that can do this, but detecting usage within javascript is tricky).
Would it be possible to write a Webpack plugin that does that, provided you wrap all class names in a function? For example in React you'd have something like:
import { classes } from 'tailwind'
return <div className={classes('w-10 h-10 hover:shadow')}>...</div>
from tailwindcss.
Consolidate into #136.
from tailwindcss.
Now I know that I can add that utility myself pretty easily, but I thought that it is a fairly common thing to do, so might as well be considered to be added to the core.
Please can you show me how? I cant figure it out, been trying for 6 hours already.
from tailwindcss.
Related Issues (20)
- Tailwind classes not work in mfe remote module
- Shadow does not apply when size is instantiated on hover HOT 5
- Add group values to Tailwind CSS
- [V4] - @keyframes not being hoisted into built css HOT 1
- group not working in conjunction to data selectors? HOT 4
- Breaking changes in plugins potentially caused by parser changes HOT 12
- Vendor prefix not being applied for `backdrop-filter`, using CLI tool HOT 2
- feat: text-shadow
- Colon separated class bindings in Vue does not generate the expected class HOT 2
- Issue on passing arbitrary values HOT 3
- Talwind 4 alpha firefox space-x issues HOT 1
- Configuration file `content` relative paths are not relative to the configuration file location HOT 2
- `contain-layout` does not seem to work v4 HOT 2
- Arbitrary variant nesting selector doesn't work with data attribute selector HOT 2
- [V4] @tailwindcss-vite: Cannot read properties of undefined (reading 'send') HOT 1
- Missing `exports` field in the package.json file HOT 2
- Tailwind HMR does not work with Next.js with symlinks
- Tailwind generates inappropriate class names for custom colors HOT 1
- Tailwindcss can't be able to capitalize UPERCASE default text HOT 2
- Tailwind Css Grid Image Sizing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tailwindcss.