From b1e2c8fd5cb5dfa46bc440a12eafaf56cd844b1c Mon Sep 17 00:00:00 2001 From: Philipp Tanlak Date: Mon, 24 Nov 2025 20:54:57 +0100 Subject: Docs --- node_modules/tailwindcss/src/util/nameClass.js | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 node_modules/tailwindcss/src/util/nameClass.js (limited to 'node_modules/tailwindcss/src/util/nameClass.js') diff --git a/node_modules/tailwindcss/src/util/nameClass.js b/node_modules/tailwindcss/src/util/nameClass.js new file mode 100644 index 0000000..cb37dba --- /dev/null +++ b/node_modules/tailwindcss/src/util/nameClass.js @@ -0,0 +1,30 @@ +import escapeClassName from './escapeClassName' +import escapeCommas from './escapeCommas' + +export function asClass(name) { + return escapeCommas(`.${escapeClassName(name)}`) +} + +export default function nameClass(classPrefix, key) { + return asClass(formatClass(classPrefix, key)) +} + +export function formatClass(classPrefix, key) { + if (key === 'DEFAULT') { + return classPrefix + } + + if (key === '-' || key === '-DEFAULT') { + return `-${classPrefix}` + } + + if (key.startsWith('-')) { + return `-${classPrefix}${key}` + } + + if (key.startsWith('/')) { + return `${classPrefix}${key}` + } + + return `${classPrefix}-${key}` +} -- cgit v1.2.3