2021-09-03 13:48:16 +02:00
|
|
|
import path from 'path'
|
|
|
|
|
import postcss from 'postcss'
|
|
|
|
|
import tailwind from '../../src'
|
2021-12-14 12:21:38 -05:00
|
|
|
import { DEFAULTS_LAYER } from '../../src/lib/expandTailwindAtRules'
|
2021-09-03 13:48:16 +02:00
|
|
|
|
|
|
|
|
export function run(input, config, plugin = tailwind) {
|
|
|
|
|
let { currentTestName } = expect.getState()
|
|
|
|
|
|
2021-12-14 12:21:38 -05:00
|
|
|
if (typeof config === 'object' && Object.keys(config).length > 0) {
|
|
|
|
|
config[DEFAULTS_LAYER] = config[DEFAULTS_LAYER] ?? input.includes('@tailwind base')
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-03 13:48:16 +02:00
|
|
|
return postcss(plugin(config)).process(input, {
|
|
|
|
|
from: `${path.resolve(__filename)}?test=${currentTestName}`,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-18 12:08:48 +02:00
|
|
|
export let css = String.raw
|
|
|
|
|
export let html = String.raw
|
|
|
|
|
export let javascript = String.raw
|