|
1 |
| -import fs from 'node:fs/promises'; |
2 |
| -import { basename, dirname, join } from 'node:path'; |
3 |
| -import { globSync, convertPathToPattern } from 'fast-glob'; |
4 |
| -import { defineConfig, presetIcons, presetUno, transformerDirectives } from 'unocss'; |
5 |
| -import { rules, shortcuts, theme } from '@tutorialkit/theme'; |
6 |
| - |
7 |
| -const iconPaths = globSync('./icons/languages/*.svg'); |
8 |
| - |
9 |
| -const customIconCollection = iconPaths.reduce( |
10 |
| - (acc, iconPath) => { |
11 |
| - const collectionName = basename(dirname(iconPath)); |
12 |
| - const [iconName] = basename(iconPath).split('.'); |
13 |
| - |
14 |
| - acc[collectionName] ??= {}; |
15 |
| - acc[collectionName][iconName] = async () => fs.readFile(iconPath, 'utf8'); |
16 |
| - |
17 |
| - return acc; |
18 |
| - }, |
19 |
| - {} as Record<string, Record<string, () => Promise<string>>>, |
20 |
| -); |
| 1 | +import { defineConfig } from '@tutorialkit/theme'; |
21 | 2 |
|
22 | 3 | export default defineConfig({
|
23 |
| - rules, |
24 |
| - shortcuts, |
25 |
| - theme, |
26 |
| - content: { |
27 |
| - inline: globSync([ |
28 |
| - `${convertPathToPattern(join(require.resolve('@tutorialkit/components-react'), '..')).replace('\\@', '/@')}/**/*.js`, |
29 |
| - `${convertPathToPattern(join(require.resolve('@tutorialkit/astro'), '..')).replace('\\@', '/@')}/default/**/*.astro`, |
30 |
| - ]).map((filePath) => { |
31 |
| - return () => fs.readFile(filePath, { encoding: 'utf8' }); |
32 |
| - }), |
33 |
| - }, |
34 |
| - transformers: [transformerDirectives()], |
35 |
| - presets: [ |
36 |
| - presetUno({ |
37 |
| - dark: { |
38 |
| - dark: '[data-theme="dark"]', |
39 |
| - }, |
40 |
| - }), |
41 |
| - presetIcons({ |
42 |
| - collections: { |
43 |
| - ...customIconCollection, |
44 |
| - }, |
45 |
| - }), |
46 |
| - ], |
| 4 | + // add your UnoCSS config here: https://unocss.dev/guide/config-file |
47 | 5 | });
|
0 commit comments