Skip to content

Commit 141c558

Browse files
authored
Merge pull request tailwindlabs#105 from Daronspence/arbitrary-margin
Arbitrary margin value proof of concept
2 parents f9d8c89 + 6a45586 commit 141c558

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/corePlugins/margin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { asLength, nameClass } = require('../pluginUtils')
1+
const { asLength, nameClass, asValue } = require('../pluginUtils')
22

33
module.exports = function ({ matchUtilities, jit: { theme } }) {
44
matchUtilities({
@@ -34,7 +34,7 @@ module.exports = function ({ matchUtilities, jit: { theme } }) {
3434
})
3535
matchUtilities({
3636
mt: (modifier, { theme, candidate }) => {
37-
let value = asLength(modifier, theme['margin'])
37+
let value = asValue(modifier, theme['margin'])
3838

3939
if (value === undefined) {
4040
return []

tests/08-arbitrary-values.test.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
--tw-ring-offset-shadow: 0 0 #0000;
88
--tw-ring-shadow: 0 0 #0000;
99
}
10+
.mt-\[clamp\(30px\2c 100px\)\] {
11+
margin-top: clamp(30px, 100px);
12+
}
1013
.w-\[3\.23rem\] {
1114
width: 3.23rem;
1215
}

tests/08-arbitrary-values.test.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
<div class="rotate-[23deg] rotate-[2.3rad] rotate-[401grad] rotate-[1.5turn]"></div>
2424
<div class="text-[2.23rem]"></div>
2525
<div class="duration-[2s]"></div>
26+
<div class="mt-[clamp(30px,100px)]"></div>
2627
</body>
2728
</html>

0 commit comments

Comments
 (0)