Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Arbitrary margin value proof of concept #105

Merged
merged 1 commit into from Mar 19, 2021

Conversation

daronspence
Copy link
Contributor

Did I provide a test: YES
Do the tests pass: YES
Is this ready to merge: NO

I used what Adam did in #99 as inspiration for this PR.

I have updated the tests to include a proposed acceptance, though there is still more work to be done to add this support to the other utility classes. The test is definitely brittle.

Since this swaps out asLength for asValue, I'm guessing that might break something else in the framework, though the tests in this repo did not break. ¯\_(ツ)_/¯

I couldn't wrap my head around most of the source code, but I noticed in the asValue() helper function, that there is some special stuff going on for calc(). I wonder if all of the CSS functions could be supported using a similar method?

I also wonder if you can use asLength first, and if that returns undefined to then instead try and look for a supported list of arbitrary CSS functions? I know #102 mentions using var() and my example is clamp()

As a slight tangent, I think this would be super valuable to include, because of the utility of these arbitrary function values. Functions like clamp/min/max etc are extremely helpful for building custom one off design elements.

Great work on the JIT; Overall, it's awesome 🤘

@adamwathan
Copy link
Member

Looks good, thanks @daronspence!

@adamwathan adamwathan merged commit 141c558 into tailwindlabs:main Mar 19, 2021
@adamwathan
Copy link
Member

Ah, just noticed you only updated mt (margin-top), I'll update the rest :)

@daronspence daronspence deleted the arbitrary-margin branch March 20, 2021 05:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants