-
Notifications
You must be signed in to change notification settings - Fork 4
feat: 增加 UnoCSS 集成、input-number 样式文档优化、修复 vitepress 配置 ts 类型错误 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,55 @@ | ||
| import process from 'node:process' | ||
| import { fileURLToPath } from 'node:url' | ||
| import { demoPreviewPlugin } from '@vitepress-code-preview/plugin' | ||
| import { defineConfig } from 'vitepress' | ||
| import nav from './config/nav' | ||
| import sidebar from './config/sidebar' | ||
|
|
||
| export default ({ mode }) => { | ||
| const basePath = mode === 'development' ? '/' : '/ccui/' | ||
| const prod = !!process.env.NETLIFY | ||
|
|
||
| return { | ||
| base: basePath, | ||
| lang: 'zh-CN', | ||
| title: 'vue3-ccui', | ||
| description: 'vue3-ccui 组件库', | ||
| lastUpdated: true, | ||
| ignoreDeadLinks: true, // 忽略死链接 | ||
| head: [ | ||
| // 这里的路径没有被自动更改 手动更改路径 | ||
| [ | ||
| 'link', | ||
| { rel: 'icon', type: 'image/svg+xml', href: `${basePath}logo.svg` }, | ||
| ], | ||
| [ | ||
| 'link', | ||
| { | ||
| rel: 'stylesheet', | ||
| href: 'https://unpkg.com/vue3-ccui/theme/darkTheme.css', | ||
| }, | ||
| ], | ||
| export default defineConfig({ | ||
| base: prod ? '/ccui/' : '/', | ||
| lang: 'zh-CN', | ||
| title: 'vue3-ccui', | ||
| description: 'vue3-ccui 组件库', | ||
| lastUpdated: true, | ||
| ignoreDeadLinks: true, // 忽略死链接 | ||
| head: [ | ||
| // 这里的路径没有被自动更改 手动更改路径 | ||
| [ | ||
| 'link', | ||
| { rel: 'icon', type: 'image/svg+xml', href: `${prod ? '/ccui/' : '/'}logo.svg` }, | ||
| ], | ||
| markdown: { | ||
| config(md) { | ||
| const docRoot = fileURLToPath(new URL('../', import.meta.url)) | ||
| md.use(demoPreviewPlugin, { docRoot }) | ||
| [ | ||
| 'link', | ||
| { | ||
| rel: 'stylesheet', | ||
| href: 'https://unpkg.com/vue3-ccui/theme/darkTheme.css', | ||
| }, | ||
| ], | ||
| ], | ||
| markdown: { | ||
| config(md) { | ||
| const docRoot = fileURLToPath(new URL('../', import.meta.url)) | ||
| md.use(demoPreviewPlugin, { docRoot }) | ||
| }, | ||
| themeConfig: { | ||
| sidebar, | ||
| nav, | ||
| logo: '/logo.svg', | ||
| algolia: { | ||
| appId: 'K0NNJA38K6', | ||
| apiKey: '0b6d20552d2073390d2bbb0a84fb49dd', | ||
| indexName: 'ccui', | ||
| }, | ||
| socialLinks: [ | ||
| { icon: 'github', link: 'https://github.com/vaebe/ccui.git' }, | ||
| ], | ||
| outlineTitle: '快速前往', | ||
| footer: { | ||
| message: 'Released under the MIT License.', | ||
| copyright: 'Copyright © 2022-present vaebe', | ||
| }, | ||
| }, | ||
| themeConfig: { | ||
| sidebar, | ||
| nav, | ||
| logo: '/logo.svg', | ||
| algolia: { | ||
| appId: 'K0NNJA38K6', | ||
| apiKey: '0b6d20552d2073390d2bbb0a84fb49dd', | ||
| indexName: 'ccui', | ||
| }, | ||
| socialLinks: [ | ||
| { icon: 'github', link: 'https://github.com/vaebe/ccui.git' }, | ||
| ], | ||
| outlineTitle: '快速前往', | ||
| footer: { | ||
| message: 'Released under the MIT License.', | ||
| copyright: 'Copyright © 2022-present vaebe', | ||
| }, | ||
| } | ||
| } | ||
| }, | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { defineConfig } from 'unocss' | ||
|
|
||
| export default defineConfig({ | ||
| // ...UnoCSS options | ||
| }) | ||
|
Comment on lines
+1
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add UnoCSS preset configuration. The UnoCSS configuration is empty and lacks preset definitions. The utility classes used throughout the documentation (such as Apply this diff to add a default preset: import { defineConfig } from 'unocss'
+import presetUno from '@unocss/preset-uno'
export default defineConfig({
- // ...UnoCSS options
+ presets: [
+ presetUno(),
+ ],
})Alternatively, if you prefer Tailwind-compatible utilities: import { defineConfig } from 'unocss'
import presetWind from '@unocss/preset-wind'
export default defineConfig({
presets: [
presetWind(),
],
})Note: You may need to install the preset package if not already included with the main 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pin version for external CDN stylesheet.
The external stylesheet link to unpkg uses an unpinned version, which could lead to unexpected style changes or breakage if the package is updated or unpkg experiences downtime.
Apply this diff to pin to a specific version:
[ 'link', { rel: 'stylesheet', - href: 'https://unpkg.com/vue3-ccui/theme/darkTheme.css', + href: 'https://unpkg.com/vue3-ccui@1.2.2/theme/darkTheme.css', }, ],Alternatively, consider bundling the dark theme CSS locally to avoid external dependencies:
[ 'link', { rel: 'stylesheet', - href: 'https://unpkg.com/vue3-ccui/theme/darkTheme.css', + href: `${prod ? '/ccui/' : '/'}darkTheme.css`, }, ],This would require copying the darkTheme.css to your public directory.
📝 Committable suggestion
🤖 Prompt for AI Agents