Skip to content

Commit

Permalink
only add the @defaults for jit mode
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed Sep 8, 2021
1 parent 2122daf commit bf248cb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plugins/divideWidth.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export default function () {
return function ({ matchUtilities, addUtilities, theme, variants }) {
return function ({ matchUtilities, addUtilities, theme, variants, config }) {
matchUtilities(
{
'divide-x': (value) => {
value = value === '0' ? '0px' : value

return {
'& > :not([hidden]) ~ :not([hidden])': {
'@defaults border-width': {},
...(config('mode') === 'jit' ? { '@defaults border-width': {} } : {}),
'--tw-divide-x-reverse': '0',
'border-right-width': `calc(${value} * var(--tw-divide-x-reverse))`,
'border-left-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`,
Expand All @@ -19,7 +19,7 @@ export default function () {

return {
'& > :not([hidden]) ~ :not([hidden])': {
'@defaults border-width': {},
...(config('mode') === 'jit' ? { '@defaults border-width': {} } : {}),
'--tw-divide-y-reverse': '0',
'border-top-width': `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`,
'border-bottom-width': `calc(${value} * var(--tw-divide-y-reverse))`,
Expand All @@ -37,11 +37,11 @@ export default function () {
addUtilities(
{
'.divide-y-reverse > :not([hidden]) ~ :not([hidden])': {
'@defaults border-width': {},
...(config('mode') === 'jit' ? { '@defaults border-width': {} } : {}),
'--tw-divide-y-reverse': '1',
},
'.divide-x-reverse > :not([hidden]) ~ :not([hidden])': {
'@defaults border-width': {},
...(config('mode') === 'jit' ? { '@defaults border-width': {} } : {}),
'--tw-divide-x-reverse': '1',
},
},
Expand Down

0 comments on commit bf248cb

Please sign in to comment.