source: frontend/node_modules/tailwindcss/src/util/nameClass.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 634 bytes
RevLine 
[9af201e]1import escapeClassName from './escapeClassName'
2import escapeCommas from './escapeCommas'
3
4export function asClass(name) {
5 return escapeCommas(`.${escapeClassName(name)}`)
6}
7
8export default function nameClass(classPrefix, key) {
9 return asClass(formatClass(classPrefix, key))
10}
11
12export function formatClass(classPrefix, key) {
13 if (key === 'DEFAULT') {
14 return classPrefix
15 }
16
17 if (key === '-' || key === '-DEFAULT') {
18 return `-${classPrefix}`
19 }
20
21 if (key.startsWith('-')) {
22 return `-${classPrefix}${key}`
23 }
24
25 if (key.startsWith('/')) {
26 return `${classPrefix}${key}`
27 }
28
29 return `${classPrefix}-${key}`
30}
Note: See TracBrowser for help on using the repository browser.