generated from sonofmagic/monorepo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathutils.ts
31 lines (28 loc) · 759 Bytes
/
utils.ts
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
import fs from 'fs-extra'
import path from 'pathe'
import postcss from 'postcss'
import tailwindcss from 'tailwindcss-3'
export const fixturesRoot = path.resolve(__dirname, './fixtures')
export const appRoot = path.resolve(fixturesRoot, './apps')
export function getTestCase(caseName: string) {
return fs.readFileSync(path.resolve(__dirname, 'fixtures', caseName), 'utf8')
}
// @tailwind base;
// @tailwind components;
export async function getCss(raw: string | string[]) {
if (typeof raw === 'string') {
raw = [raw]
}
const res = await postcss([
tailwindcss({
content: raw.map((x) => {
return {
raw: x,
}
}),
}),
]).process('@tailwind utilities;', {
from: undefined,
})
return res.css
}