mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Use existing prefixSelector function
This commit is contained in:
parent
dfb8c256ab
commit
e497a2b5de
@ -216,3 +216,29 @@ test('you can apply utility classes without using the given prefix', () => {
|
||||
expect(result.warnings().length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
// test('you can apply utility classes without using the given prefix when using a function for the prefix', () => {
|
||||
// const input = `
|
||||
// .foo { @apply .tw-mt-4 .mb-4; }
|
||||
// `
|
||||
|
||||
// const expected = `
|
||||
// .foo { margin-top: 1rem; margin-bottom: 1rem; }
|
||||
// `
|
||||
|
||||
// const config = {
|
||||
// ...defaultConfig,
|
||||
// options: {
|
||||
// ...defaultConfig.options,
|
||||
// prefix: selector => {
|
||||
// return 'tw-'
|
||||
// },
|
||||
// },
|
||||
// experiments: { shadowLookup: true },
|
||||
// }
|
||||
|
||||
// return run(input, config, generateUtilities(config, [])).then(result => {
|
||||
// expect(result.css).toEqual(expected)
|
||||
// expect(result.warnings().length).toBe(0)
|
||||
// })
|
||||
// })
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import _ from 'lodash'
|
||||
import postcss from 'postcss'
|
||||
import escapeClassName from '../util/escapeClassName'
|
||||
import prefixSelector from '../util/prefixSelector'
|
||||
|
||||
function buildClassTable(css) {
|
||||
const classTable = {}
|
||||
@ -35,7 +36,7 @@ function findClass(classToApply, classTable, shadowLookup, prefix, onError) {
|
||||
if (_.isEmpty(matches)) {
|
||||
if (_.isEmpty(shadowLookup)) {
|
||||
if (prefix) {
|
||||
classToApply = '.' + prefix + classToApply.substr(1)
|
||||
classToApply = prefixSelector(prefix, classToApply)
|
||||
matches = _.get(classTable, classToApply, [])
|
||||
if (_.isEmpty(matches)) {
|
||||
if (_.isEmpty(shadowLookup)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user