Jordan Pittman b94d565eb6
Preserve source maps for generated CSS (#7588)
* Preserve source maps for `@apply`

* Overwrite the source for all cloned descendants

* Preserve source maps when expanding defaults

* Verify that source maps are correctly generated

* Update changelog
2022-02-23 11:24:54 -05:00

34 lines
745 B
JavaScript

import path from 'path'
import postcss from 'postcss'
import tailwind from '../../src'
export * from './strings'
export * from './defaults'
let map = JSON.stringify({
version: 3,
file: null,
sources: [],
names: [],
mappings: '',
})
export function run(input, config, plugin = tailwind) {
let { currentTestName } = expect.getState()
return postcss(plugin(config)).process(input, {
from: `${path.resolve(__filename)}?test=${currentTestName}`,
})
}
export function runWithSourceMaps(input, config, plugin = tailwind) {
let { currentTestName } = expect.getState()
return postcss(plugin(config)).process(input, {
from: `${path.resolve(__filename)}?test=${currentTestName}`,
map: {
prev: map,
},
})
}