Skip to content

Commit 2bc2b9b

Browse files
antfulucpotageuserquinzyyvsudongyuer
authored
docs: static docs (unocss#2386) (unocss#2432)
Co-authored-by: Luc <luc.potage@gmail.com> Co-authored-by: userquin <userquin@gmail.com> Co-authored-by: Chris <1633711653@qq.com> Co-authored-by: Joaquín Sánchez <joaquin.sanchez@fi2net.es> Co-authored-by: Frozen FIsh <76603360+sudongyuer@users.noreply.github.com> Co-authored-by: Ben M <xbenmmusicx@gmail.com> Co-authored-by: Saya <379924+chu121su12@users.noreply.github.com>
1 parent ef02bb1 commit 2bc2b9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+5504
-1741
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ interactive/data/guides.ts
66
defaultConfig.ts
77
packages/preset-icons/src/collections.json
88
packages/eslint-plugin/fixtures
9+
!.vitepress
10+
docs/.vitepress/cache/deps/*.*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ interactive/public/play
2323
interactive/public/shiki
2424
.svelte-kit
2525
.eslintcache
26+
vite.config.ts.timestamp-*

README.md

Lines changed: 26 additions & 559 deletions
Large diffs are not rendered by default.

docs/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.vitepress/cache/
2+
.vitepress/dist/
3+
public/user-avatars

docs/.vitepress/config.ts

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
import { defineConfig } from 'vitepress'
2+
import type { DefaultTheme } from 'vitepress/types'
3+
import { version } from '../../package.json'
4+
5+
const Guides: DefaultTheme.NavItemWithLink[] = [
6+
{ text: 'Getting Started', link: '/guide/' },
7+
{ text: 'Why UnoCSS?', link: '/guide/why' },
8+
{ text: 'Presets', link: '/guide/presets' },
9+
{ text: 'Style reset', link: '/guide/style-reset' },
10+
{ text: 'Config file', link: '/guide/config-file' },
11+
{ text: 'Extracting & Safelist', link: '/guide/extracting' },
12+
]
13+
14+
const Configs: DefaultTheme.NavItemWithLink[] = [
15+
{ text: 'Overview', link: '/config/' },
16+
{ text: 'Rules', link: '/config/rules' },
17+
{ text: 'Shortcuts', link: '/config/shortcuts' },
18+
{ text: 'Theme', link: '/config/theme' },
19+
{ text: 'Variants', link: '/config/variants' },
20+
{ text: 'Extractors', link: '/config/extractors' },
21+
{ text: 'Transformers', link: '/config/transformers' },
22+
{ text: 'Preflights', link: '/config/preflights' },
23+
{ text: 'Layers', link: '/config/layers' },
24+
{ text: 'Presets', link: '/config/presets' },
25+
]
26+
27+
const Integrations: DefaultTheme.NavItemWithLink[] = [
28+
{ text: 'Vite', link: '/integrations/vite' },
29+
{ text: 'Nuxt', link: '/integrations/nuxt' },
30+
{ text: 'Astro', link: '/integrations/astro' },
31+
{ text: 'Webpack', link: '/integrations/webpack' },
32+
{ text: 'Runtime', link: '/integrations/runtime' },
33+
{ text: 'CLI', link: '/integrations/cli' },
34+
{ text: 'PostCSS', link: '/integrations/postcss' },
35+
{ text: 'ESLint', link: '/integrations/eslint' },
36+
{ text: 'VSCode extension', link: '/integrations/vscode' },
37+
]
38+
39+
const Presets: DefaultTheme.NavItemWithLink[] = [
40+
{ text: 'Uno (default)', link: '/presets/uno' },
41+
{ text: 'Icons', link: '/presets/icons' },
42+
{ text: 'Attributify', link: '/presets/attributify' },
43+
{ text: 'Typography', link: '/presets/typography' },
44+
{ text: 'Web fonts', link: '/presets/web-fonts' },
45+
{ text: 'Wind', link: '/presets/wind' },
46+
{ text: 'Mini', link: '/presets/mini' },
47+
{ text: 'Tagify', link: '/presets/tagify' },
48+
{ text: 'Rem to px', link: '/presets/rem-to-px' },
49+
]
50+
51+
const Transformers: DefaultTheme.NavItemWithLink[] = [
52+
{ text: 'Variant Group', link: '/transformers/variant-group' },
53+
{ text: 'Directives', link: '/transformers/directives' },
54+
{ text: 'Compile class', link: '/transformers/compile-class' },
55+
{ text: 'Attributify JSX', link: '/transformers/attributify-jsx' },
56+
]
57+
58+
const Extractors: DefaultTheme.NavItemWithLink[] = [
59+
{ text: 'Pug extractor', link: '/extractors/pug' },
60+
// { text: 'Svelte extractor', link: '/extractors/svelte' },
61+
]
62+
63+
const Tools: DefaultTheme.NavItemWithLink[] = [
64+
{ text: 'Inspector', link: '/tools/inspector' },
65+
{ text: 'Core', link: '/tools/core' },
66+
{ text: 'Autocomplete', link: '/tools/autocomplete' },
67+
]
68+
69+
const Nav: DefaultTheme.NavItem[] = [
70+
{
71+
text: 'Guide',
72+
items: [
73+
{
74+
text: 'Guide',
75+
items: Guides,
76+
},
77+
],
78+
},
79+
{
80+
text: 'Integrations',
81+
items: [
82+
{
83+
text: 'Integrations',
84+
items: Integrations,
85+
},
86+
{
87+
text: 'Examples',
88+
link: 'https://github.com/unocss/unocss/tree/main/examples',
89+
},
90+
],
91+
},
92+
{
93+
text: 'Config',
94+
items: [
95+
{
96+
text: 'Config File',
97+
link: '/guide/config-file',
98+
},
99+
{
100+
text: 'Concepts',
101+
items: Configs,
102+
},
103+
],
104+
},
105+
{
106+
text: 'Presets',
107+
items: [
108+
{
109+
text: 'Overview',
110+
link: '/presets/',
111+
},
112+
{
113+
text: 'Community Presets',
114+
link: '/presets/community',
115+
},
116+
{
117+
text: 'Presets',
118+
items: Presets,
119+
},
120+
{
121+
text: 'Transformers',
122+
items: Transformers,
123+
},
124+
{
125+
text: 'Extractors',
126+
items: Extractors,
127+
},
128+
],
129+
},
130+
{ text: 'Interactive Docs', link: '/interactive/', target: '_blank' },
131+
{ text: 'Playground', link: '/play/', target: '_blank' },
132+
{
133+
text: `v${version}`,
134+
items: [
135+
{
136+
text: 'Release Notes',
137+
link: 'https://github.com/unocss/unocss/releases',
138+
},
139+
{
140+
text: 'Contributing',
141+
link: 'https://github.com/unocss/unocss/blob/main/CONTRIBUTING.md',
142+
},
143+
],
144+
},
145+
]
146+
147+
const SidebarGuide: DefaultTheme.SidebarItem[] = [
148+
{
149+
text: 'Guides',
150+
items: Guides,
151+
},
152+
{
153+
text: 'Integrations',
154+
items: Integrations,
155+
},
156+
{
157+
text: 'Presets',
158+
link: '/presets/',
159+
},
160+
{
161+
text: 'Config',
162+
link: '/config/',
163+
},
164+
{
165+
text: 'Examples',
166+
link: 'https://github.com/unocss/unocss/tree/main/examples',
167+
},
168+
]
169+
170+
const SidebarPresets: DefaultTheme.SidebarItem[] = [
171+
{
172+
text: 'Overview',
173+
link: '/presets/',
174+
},
175+
{
176+
text: 'Presets',
177+
collapsed: false,
178+
items: Presets,
179+
},
180+
{
181+
text: 'Community Presets',
182+
link: '/presets/community',
183+
},
184+
{
185+
text: 'Transformers',
186+
collapsed: false,
187+
items: Transformers,
188+
},
189+
{
190+
text: 'Extractors',
191+
collapsed: false,
192+
items: Extractors,
193+
},
194+
{
195+
text: 'Other packages',
196+
collapsed: false,
197+
items: Tools,
198+
},
199+
]
200+
201+
const SidebarConfig: DefaultTheme.SidebarItem[] = [
202+
{
203+
text: 'Config',
204+
collapsed: false,
205+
items: Configs,
206+
},
207+
{
208+
text: 'Config File',
209+
link: '/guide/config-file',
210+
},
211+
]
212+
213+
// TODO: verify this is the correct url
214+
const ogUrl = 'https://unocss.dev/'
215+
const ogImage = `${ogUrl}og-image.png`
216+
const title = 'UnoCSS'
217+
const description = 'The instant on-demand Atomic CSS engine'
218+
219+
export default defineConfig({
220+
lang: 'en-US',
221+
title,
222+
titleTemplate: title,
223+
description,
224+
outDir: './dist',
225+
head: [
226+
['link', { rel: 'icon', href: '/logo.svg', type: 'image/svg+xml' }],
227+
['link', { rel: 'alternate icon', href: '/favicon.ico', type: 'image/png', sizes: '16x16' }],
228+
['meta', { name: 'author', content: 'Anthony Fu' }],
229+
['meta', { property: 'og:type', content: 'website' }],
230+
['meta', { name: 'og:title', content: title }],
231+
['meta', { name: 'og:description', content: description }],
232+
['meta', { property: 'og:image', content: ogImage }],
233+
['meta', { name: 'twitter:title', content: title }],
234+
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
235+
['meta', { name: 'twitter:image', content: ogImage }],
236+
['meta', { name: 'twitter:site', content: '@antfu7' }],
237+
['meta', { name: 'twitter:url', content: ogUrl }],
238+
],
239+
lastUpdated: true,
240+
cleanUrls: true,
241+
ignoreDeadLinks: [
242+
/^\/play/,
243+
/^\/interactive/,
244+
/:\/\/localhost/,
245+
],
246+
247+
markdown: {
248+
theme: {
249+
light: 'vitesse-light',
250+
dark: 'vitesse-dark',
251+
},
252+
},
253+
254+
themeConfig: {
255+
logo: '/logo.svg',
256+
nav: Nav,
257+
sidebar: {
258+
'/guide/': SidebarGuide,
259+
'/integrations/': SidebarGuide,
260+
261+
'/tools/': SidebarPresets,
262+
'/presets/': SidebarPresets,
263+
'/transformers/': SidebarPresets,
264+
'/extractors/': SidebarPresets,
265+
266+
'/config/': SidebarConfig,
267+
},
268+
editLink: {
269+
pattern: 'https://github.com/unocss/unocss/docs/edit/main/docs/:path',
270+
text: 'Suggest changes to this page',
271+
},
272+
socialLinks: [
273+
{ icon: 'github', link: 'https://github.com/unocss/unocss' },
274+
{ icon: 'discord', link: 'http://chat.antfu.me' },
275+
],
276+
footer: {
277+
message: 'Released under the MIT License.',
278+
copyright: 'Copyright © 2021-PRESENT Anthony Fu',
279+
},
280+
},
281+
})

0 commit comments

Comments
 (0)