Jordan Pittman 4041d04b89
Move defaults to their own always-on layer (#6500)
Default's declarations are now processed and merged even when there is no tailwind base directive included in the stylesheet. Without this applying tailwind utilities in css modules would break if they relied on defaults rules.

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2021-12-14 12:21:38 -05:00

21 lines
638 B
JavaScript

import path from 'path'
import postcss from 'postcss'
import tailwind from '../../src'
import { DEFAULTS_LAYER } from '../../src/lib/expandTailwindAtRules'
export function run(input, config, plugin = tailwind) {
let { currentTestName } = expect.getState()
if (typeof config === 'object' && Object.keys(config).length > 0) {
config[DEFAULTS_LAYER] = config[DEFAULTS_LAYER] ?? input.includes('@tailwind base')
}
return postcss(plugin(config)).process(input, {
from: `${path.resolve(__filename)}?test=${currentTestName}`,
})
}
export let css = String.raw
export let html = String.raw
export let javascript = String.raw