Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
list all allowed bare value data types
  • Loading branch information
RobinMalfait committed Apr 3, 2025
commit 7b4a7735fd7728a3dae0b4f9e28b0d56c1bc682d
17 changes: 11 additions & 6 deletions packages/tailwindcss/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5692,6 +5692,16 @@ export function createUtilities(theme: Theme) {
return utilities
}

// Only allowed bare value data types, to prevent creating new syntax that we
// typically don't support right now. E.g.: `--value(color)` would allow you to
// use `text-#0088cc` as a valid utility, which is not what we want.
export const BARE_VALUE_DATA_TYPES = [
'number', // 2.5
'integer', // 8
'ratio', // 2/3
'percentage', // 25%
]

export function createCssUtility(node: AtRule) {
let name = node.params

Expand Down Expand Up @@ -6084,12 +6094,7 @@ function resolveValueFunction(
// Limit the bare value types, to prevent new syntax that we
// don't want to support. E.g.: `text-#000` is something we
// don't want to support, but could be built this way.
if (
arg.value !== 'number' &&
arg.value !== 'integer' &&
arg.value !== 'ratio' &&
arg.value !== 'percentage'
) {
if (!BARE_VALUE_DATA_TYPES.includes(arg.value)) {
continue
}

Expand Down