Skip to content

Commit

Permalink
Fix arbitrary value support for fontSize
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwathan committed May 4, 2021
1 parent f1507b6 commit 018c630
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 38 deletions.
7 changes: 7 additions & 0 deletions __tmp_6-0/tailwind.config.cjs
@@ -0,0 +1,7 @@
module.exports = {
theme: {
screens: {
mobile: '400px',
},
},
}
7 changes: 7 additions & 0 deletions __tmp_6-2/tailwind.config.cjs
@@ -0,0 +1,7 @@
module.exports = {
theme: {
screens: {
mobile: '400px',
},
},
}
25 changes: 0 additions & 25 deletions src/jit/lib/setupContext.js
Expand Up @@ -513,31 +513,6 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
.push([{ sort: offset, layer: 'utilities', options }, rule])
}
},
matchUtilities: function (utilities, options) {
let defaultOptions = {
variants: [],
respectPrefix: true,
respectImportant: true,
respectVariants: true,
}

options = { ...defaultOptions, ...options }

let offset = offsets.utilities++

for (let identifier in utilities) {
let prefixedIdentifier = prefixIdentifier(identifier, options)
let rule = utilities[identifier]

let withOffsets = [{ sort: offset, layer: 'utilities', options }, rule]

if (!context.candidateRuleMap.has(prefixedIdentifier)) {
context.candidateRuleMap.set(prefixedIdentifier, [])
}

context.candidateRuleMap.get(prefixedIdentifier).push(withOffsets)
}
},
matchUtilities2: function (utilities, options) {
let defaultOptions = {
variants: [],
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/fontSize.js
Expand Up @@ -20,7 +20,7 @@ export default function () {
{
values: theme('fontSize'),
variants: variants('fontSize'),
type: 'lookup',
type: 'length',
}
)
}
Expand Down
12 changes: 0 additions & 12 deletions src/util/pluginUtils.js
Expand Up @@ -137,18 +137,6 @@ export function asUnit(modifier, units, lookup = {}) {
})
}

export function createSimpleStaticUtilityPlugin(styles) {
return function ({ matchUtilities }) {
matchUtilities(
Object.entries(styles).reduce((newStyles, [selector, rules]) => {
let result = { [selector]: rules }
newStyles[selector.slice(1)] = [result]
return newStyles
}, {})
)
}
}

export function asList(modifier, lookup = {}) {
return asValue(modifier, lookup, {
transform: (value) => {
Expand Down

0 comments on commit 018c630

Please sign in to comment.