forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.js
More file actions
39 lines (33 loc) · 869 Bytes
/
run.js
File metadata and controls
39 lines (33 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import postcss from 'postcss'
import tailwind from '../../src'
export * from './strings'
export * from './defaults'
export let map = JSON.stringify({
version: 3,
file: null,
sources: [],
names: [],
mappings: '',
})
export function run(input, config, plugin = tailwind) {
let { currentTestName, testPath } = expect.getState()
let path = `${testPath}?test=${Buffer.from(currentTestName).toString('base64')}`
return postcss(plugin(config)).process(input, {
from: path,
to: path,
})
}
export function runWithSourceMaps(
input,
config,
options = { map: { prev: map } },
plugin = tailwind
) {
let { currentTestName, testPath } = expect.getState()
let path = `${testPath}?test=${Buffer.from(currentTestName).toString('base64')}`
return postcss(plugin(config)).process(input, {
from: path,
to: path,
...options,
})
}