-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Add n/12 width fractions and add all fraction values #646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Plugin territory. |
|
Yeah, this is the exact reason Tailwind has plugins: so you can extend its built in classes. It's a great idea, and if it really works you should publish it to npm. |
|
Personally, I think this deserves to be in the core. The Bootstrap argument is good, and the extra classes probably add less than 1 kb to the generated CSS (non-gzipped). Add PurgeCSS to the mix (which most people should do IMO) and this is a moot point. I think not having to remember when changing |
|
Let's see what @adamwathan says. |
|
I agree with everything @SjorsO exposed (I've done it myself in a few sites) Looks like there's already a plugin that does what I described. Link in case it helps anyone: https://github.com/buz-zard/tailwind-bootstrap-grid |
|
I would be open to adding the Long term I think all of that stuff will be better solved with CSS Grid utilities, just need to wait for IE11 to die. |
Just 6 more years! |
|
These are the only I don't think adding I think the duplicate values are a great addition to Tailwinds defaults. It makes using the width fractions more user friendly, especially for new users (less math, less remembering, no more "huh? oh 2/6 doesn't exist"). It also makes the html markup cleaner and more symmetric (see the example in my first comment). Including duplicate values gives users a choice, if they want they can just choose to use the normalized fractions, purgecss will remove all the duplicate ones they don't use. Let me know what you think, and i'll change the PR accordingly. |
|
I'm not in favor of adding n/12 fractions to default widths. I prefer to add this settings at projet level (or use a plugin). Bootstrap users argument seems wrong: we need to help users thinking in fractions instead in columns => docs, tutorial, example ... |
|
I think it would be very helpful to have all For example if one is using an 8 column grid under this new system and have starting values of I also think it would help with the wider adoption of Tailwind because it makes the switch from other common frameworks much easier. One can continue to use the grid system with which they are already familiar, but without constantly doing quick math or accidentally trying to use classes that don't exist. |
|
Changed my mind on this and I'm okay accepting it with all of the combinations added and the x/12 values added as well. Feel free to fix the conflicts and update the test fixtures so the tests pass and I'll merge, or I will add it myself next week if you don't have time. Thanks! |
|
We’re maintaining the existing widths though, right? |
|
Yeah we should keep everything if only to avoid the BC break.
…On Apr 26, 2019, 4:25 PM -0400, Clayton Stone ***@***.***>, wrote:
We’re maintaining the existing widths though, right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
@adamwathan I've fixed the conflicts. Is it documented somewhere how to generate new fixtures? I gave it a try, but they were missing the |
|
@SjorsO Thanks! We actually don't generate them except as a last resort, updating by hand is safer because if you generate them you can't be sure you didn't create a bug that you are no longer testing for by baking the bug into the test fixture. I'll update the tests though no problem. Thanks again! |
|
I know this has already been merged but this is a big 👍 from me. I've personally wrestled with the tailwind grid system a number of times and it's never quite felt "right" coming from Bootstrap's 12-column grid system. Maybe it's my small brain that struggles to grasp fractions, I don't know, it's just always seemed a bit fiddly. The small sacrifice in file size more than makes up for developer experience. Plus I've finally managed to get PurgeCSS working nicely with Webpack so filesize is no longer an issue 😁 |
This PR adds
n/12fractions to the available width values. They come in handy when making grids with more than 6 columns, or when you want more control over the width of columns. They might also make life easier for people familiar to Bootstrap's 12 column grid when they are trying out Tailwind.This PR also adds the fractions that were missing because they can be normalized. I assume they were missing because they are technically duplicates (
2/4 = 1/2), but I've found it very convenient to have all of them available. Especially when working with the newn/12fractions, having all fractions available looks nicer, prevents having to do math, and it makes it easier to quickly change around column sizes, for example:I've targeted this PR to the "next" branch, if you want it on a different branch instead let me know.