重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
slidev-project-structure by yoanbernabeu/slidev-skills
npx skills add https://github.com/yoanbernabeu/slidev-skills --skill slidev-project-structure此技能帮助您理解 Slidev 项目的完整结构,包括配置文件、目录约定和自定义选项。
my-presentation/
├── slides.md # 主演示文件
├── package.json # 项目依赖
├── components/ # 自定义 Vue 组件
│ └── Counter.vue
├── layouts/ # 自定义布局
│ └── my-layout.vue
├── pages/ # 额外的幻灯片文件
│ └── intro.md
├── public/ # 静态资源
│ ├── images/
│ └── favicon.ico
├── styles/ # 全局样式
│ └── index.css
├── setup/ # 设置脚本
│ ├── main.ts # Vue 应用设置
│ ├── monaco.ts # Monaco 编辑器设置
│ └── shiki.ts # Shiki 代码高亮设置
├── snippets/ # 外部代码片段
│ └── example.ts
├── .slidev/ # 生成的文件(gitignore)
│ └── drawings/ # 持久化的绘图
├── vite.config.ts # Vite 配置
├── uno.config.ts # UnoCSS 配置
└── netlify.toml # 部署配置(可选)
包含所有幻灯片的主演示文件:
---
theme: seriph
title: My Presentation
---
# Slide 1
---
# Slide 2
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
必要的脚本和依赖:
{
"name": "my-presentation",
"private": true,
"scripts": {
"dev": "slidev --open",
"build": "slidev build",
"export": "slidev export"
},
"dependencies": {
"@slidev/cli": "^0.50.0",
"@slidev/theme-seriph": "^0.25.0"
}
}
第一张幻灯片的前置元数据配置整个演示:
---
# 主题
theme: seriph
addons:
- slidev-addon-excalidraw
# 元数据
title: My Presentation
titleTemplate: '%s - Slidev'
info: |
## Slidev 入门模板
面向开发者的演示幻灯片。
# 外观
colorSchema: auto
aspectRatio: 16/9
canvasWidth: 980
themeConfig:
primary: '#5d8392'
# 代码
highlighter: shiki
lineNumbers: true
monaco: true
# 功能
drawings:
enabled: true
persist: true
presenterOnly: false
syncAll: true
selectable: true
record: true
# 导航
transition: slide-left
clicks: auto
# 导出
exportFilename: my-presentation
download: true
# 布局
layout: cover
background: /cover.jpg
class: text-center
---
自动导入到幻灯片中的自定义 Vue 组件:
<!-- components/Counter.vue -->
<script setup lang="ts">
import { ref } from 'vue'
const count = ref(0)
</script>
<template>
<div class="flex items-center gap-4">
<button @click="count--">-</button>
<span>{{ count }}</span>
<button @click="count++">+</button>
</div>
</template>
在幻灯片中使用:
# 交互式计数器
<Counter />
自定义布局扩展内置布局:
<!-- layouts/my-intro.vue -->
<template>
<div class="slidev-layout my-intro">
<div class="header">
<slot name="header" />
</div>
<div class="main">
<slot />
</div>
<div class="footer">
<slot name="footer">
<span>My Company</span>
</slot>
</div>
</div>
</template>
<style scoped>
.my-intro {
display: grid;
grid-template-rows: auto 1fr auto;
height: 100%;
padding: 2rem;
}
</style>
在幻灯片中使用:
---
layout: my-intro
---
::header::
# 欢迎
::default::
主要内容在此
::footer::
自定义页脚
在根 URL 下提供服务的静态资源:
public/
├── images/
│ ├── logo.png # 用法:/images/logo.png
│ └── diagram.svg
├── favicon.ico # 用法:/favicon.ico
└── data.json # 用法:/data.json
应用于所有幻灯片的全局样式:
/* styles/index.css */
@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');
:root {
--slidev-theme-primary: #3b82f6;
}
.slidev-layout {
font-family: 'Inter', sans-serif;
}
/* 自定义工具类 */
.highlight {
background: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
padding: 0 0.25em;
}
配置脚本:
// setup/main.ts - Vue 应用配置
import { defineAppSetup } from '@slidev/types'
export default defineAppSetup(({ app, router }) => {
// 注册全局组件
// 配置插件
})
// setup/shiki.ts - 代码高亮器
import { defineShikiSetup } from '@slidev/types'
export default defineShikiSetup(() => {
return {
themes: {
dark: 'vitesse-dark',
light: 'vitesse-light',
},
}
})
// setup/monaco.ts - Monaco 编辑器
import { defineMonacoSetup } from '@slidev/types'
export default defineMonacoSetup(() => {
return {
editorOptions: {
fontSize: 14,
minimap: { enabled: false },
},
}
})
用于模块化演示的额外幻灯片文件:
<!-- pages/intro.md -->
# 介绍部分
---
# 关于我
---
# 议程
在主文件中导入:
---
src: ./pages/intro.md
---
---
# 主要内容
---
---
src: ./pages/conclusion.md
---
// vite.config.ts
import { defineConfig } from 'vite'
export default defineConfig({
slidev: {
vue: {
// Vue 插件选项
},
},
// 标准 Vite 选项
server: {
port: 3030,
},
})
// uno.config.ts
import { defineConfig } from 'unocss'
export default defineConfig({
shortcuts: {
'bg-main': 'bg-white dark:bg-slate-900',
'text-main': 'text-slate-900 dark:text-slate-100',
},
theme: {
colors: {
primary: '#3b82f6',
},
},
})
---
theme: seriph
themeConfig:
primary: '#5d8392'
secondary: '#8b5cf6'
---
要自定义主题的源代码:
slidev theme eject
这会将主题复制到您的项目中进行完全自定义。
---
src: ./pages/section1.md
---
---
src: ./pages/section2.md
---
---
src: ./pages/intro.md
title: Overridden Title
class: custom-class
---
.slidev/ 目录包含:
drawings/ - 持久化的绘图添加到 .gitignore:
.slidev
node_modules
dist
src 导入public/images/ 中.slidev/ 和 dist/解释项目结构时,请提供:
RECOMMENDED STRUCTURE:
├── slides.md # 主文件
├── components/ # 自定义 Vue 组件
├── layouts/ # 自定义布局
├── public/ # 静态资源
├── styles/ # 全局 CSS
└── package.json # 依赖项
KEY CONFIGURATION:
- 主题: [theme name]
- 插件: [list of addons]
- 自定义组件: [component names]
- 自定义布局: [layout names]
FILES TO CREATE:
1. [filename] - [purpose]
2. [filename] - [purpose]
GITIGNORE:
.slidev/
node_modules/
dist/
每周安装次数
67
代码仓库
GitHub 星标数
22
首次出现
2026年1月25日
安全审计
安装于
opencode52
codex50
gemini-cli50
github-copilot49
cursor49
amp48
This skill helps you understand the complete structure of a Slidev project, including configuration files, directory conventions, and customization options.
my-presentation/
├── slides.md # Main presentation file
├── package.json # Project dependencies
├── components/ # Custom Vue components
│ └── Counter.vue
├── layouts/ # Custom layouts
│ └── my-layout.vue
├── pages/ # Additional slide files
│ └── intro.md
├── public/ # Static assets
│ ├── images/
│ └── favicon.ico
├── styles/ # Global styles
│ └── index.css
├── setup/ # Setup scripts
│ ├── main.ts # Vue app setup
│ ├── monaco.ts # Monaco editor setup
│ └── shiki.ts # Shiki highlighter setup
├── snippets/ # External code snippets
│ └── example.ts
├── .slidev/ # Generated files (gitignore)
│ └── drawings/ # Persisted drawings
├── vite.config.ts # Vite configuration
├── uno.config.ts # UnoCSS configuration
└── netlify.toml # Deployment config (optional)
The main presentation file containing all slides:
---
theme: seriph
title: My Presentation
---
# Slide 1
---
# Slide 2
Essential scripts and dependencies:
{
"name": "my-presentation",
"private": true,
"scripts": {
"dev": "slidev --open",
"build": "slidev build",
"export": "slidev export"
},
"dependencies": {
"@slidev/cli": "^0.50.0",
"@slidev/theme-seriph": "^0.25.0"
}
}
The first slide's frontmatter configures the entire presentation:
---
# Theme
theme: seriph
addons:
- slidev-addon-excalidraw
# Metadata
title: My Presentation
titleTemplate: '%s - Slidev'
info: |
## Slidev Starter Template
Presentation slides for developers.
# Appearance
colorSchema: auto
aspectRatio: 16/9
canvasWidth: 980
themeConfig:
primary: '#5d8392'
# Code
highlighter: shiki
lineNumbers: true
monaco: true
# Features
drawings:
enabled: true
persist: true
presenterOnly: false
syncAll: true
selectable: true
record: true
# Navigation
transition: slide-left
clicks: auto
# Export
exportFilename: my-presentation
download: true
# Layout
layout: cover
background: /cover.jpg
class: text-center
---
Custom Vue components auto-imported into slides:
<!-- components/Counter.vue -->
<script setup lang="ts">
import { ref } from 'vue'
const count = ref(0)
</script>
<template>
<div class="flex items-center gap-4">
<button @click="count--">-</button>
<span>{{ count }}</span>
<button @click="count++">+</button>
</div>
</template>
Use in slides:
# Interactive Counter
<Counter />
Custom layouts extend built-in ones:
<!-- layouts/my-intro.vue -->
<template>
<div class="slidev-layout my-intro">
<div class="header">
<slot name="header" />
</div>
<div class="main">
<slot />
</div>
<div class="footer">
<slot name="footer">
<span>My Company</span>
</slot>
</div>
</div>
</template>
<style scoped>
.my-intro {
display: grid;
grid-template-rows: auto 1fr auto;
height: 100%;
padding: 2rem;
}
</style>
Use in slides:
---
layout: my-intro
---
::header::
# Welcome
::default::
Main content here
::footer::
Custom footer
Static assets served at root URL:
public/
├── images/
│ ├── logo.png # Use: /images/logo.png
│ └── diagram.svg
├── favicon.ico # Use: /favicon.ico
└── data.json # Use: /data.json
Global styles applied to all slides:
/* styles/index.css */
@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');
:root {
--slidev-theme-primary: #3b82f6;
}
.slidev-layout {
font-family: 'Inter', sans-serif;
}
/* Custom utility classes */
.highlight {
background: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
padding: 0 0.25em;
}
Configuration scripts:
// setup/main.ts - Vue app configuration
import { defineAppSetup } from '@slidev/types'
export default defineAppSetup(({ app, router }) => {
// Register global components
// Configure plugins
})
// setup/shiki.ts - Code highlighter
import { defineShikiSetup } from '@slidev/types'
export default defineShikiSetup(() => {
return {
themes: {
dark: 'vitesse-dark',
light: 'vitesse-light',
},
}
})
// setup/monaco.ts - Monaco editor
import { defineMonacoSetup } from '@slidev/types'
export default defineMonacoSetup(() => {
return {
editorOptions: {
fontSize: 14,
minimap: { enabled: false },
},
}
})
Additional slide files for modular presentations:
<!-- pages/intro.md -->
# Introduction Section
---
# About Me
---
# Agenda
Import in main file:
---
src: ./pages/intro.md
---
---
# Main Content
---
---
src: ./pages/conclusion.md
---
// vite.config.ts
import { defineConfig } from 'vite'
export default defineConfig({
slidev: {
vue: {
// Vue plugin options
},
},
// Standard Vite options
server: {
port: 3030,
},
})
// uno.config.ts
import { defineConfig } from 'unocss'
export default defineConfig({
shortcuts: {
'bg-main': 'bg-white dark:bg-slate-900',
'text-main': 'text-slate-900 dark:text-slate-100',
},
theme: {
colors: {
primary: '#3b82f6',
},
},
})
---
theme: seriph
themeConfig:
primary: '#5d8392'
secondary: '#8b5cf6'
---
To customize a theme's source code:
slidev theme eject
This copies the theme to your project for full customization.
---
src: ./pages/section1.md
---
---
src: ./pages/section2.md
---
---
src: ./pages/intro.md
title: Overridden Title
class: custom-class
---
The .slidev/ directory contains:
drawings/ - Persisted drawingsAdd to .gitignore:
.slidev
node_modules
dist
src imports for large presentationspublic/images/ for all images.slidev/ and dist/When explaining project structure, provide:
RECOMMENDED STRUCTURE:
├── slides.md # Main file
├── components/ # Custom Vue components
├── layouts/ # Custom layouts
├── public/ # Static assets
├── styles/ # Global CSS
└── package.json # Dependencies
KEY CONFIGURATION:
- Theme: [theme name]
- Addons: [list of addons]
- Custom components: [component names]
- Custom layouts: [layout names]
FILES TO CREATE:
1. [filename] - [purpose]
2. [filename] - [purpose]
GITIGNORE:
.slidev/
node_modules/
dist/
Weekly Installs
67
Repository
GitHub Stars
22
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode52
codex50
gemini-cli50
github-copilot49
cursor49
amp48
NotebookLM Python库:自动化访问Google NotebookLM,实现AI内容创作与文档处理
1,900 周安装