Skill站外收录 @skilllib/skill-2014279411158167554
website-preview
提供本地 Jekyll 网站的实时预览与视觉验证能力,支持在不同设备模式和主题下截取页面快照,执行页面元素查询及交互操作,便于快速确认前端修改效果。
软件开发 AI 技能
Skills.MD
# Website Preview
Render the Jekyll site locally, take screenshots, and verify design changes visually using ChromeDriver and browser automation.
## When to use this skill
Use this skill when:
- Modifying CSS, SCSS, or any styling files
- Editing HTML layouts (`_layouts/`) or includes (`_includes/`)
- Making changes that affect visual appearance
- The user asks to see how changes look
- You need to verify a design change worked correctly
- Working on any front-end aspects of the website
**Invoke this skill proactively** after making visual changes to the site.
## How to use this skill
### Step 1: Check Prerequisites
Before taking screenshots, verify both Jekyll and ChromeDriver are running.
**Check Jekyll server:**
```bash
curl -s -o /dev/null -w "%{http_code}" http://localhost:4000/ 2>/dev/null || echo "not running"
```
If not running (not 200), start it in background:
```bash
bundle exec jekyll serve --host 0.0.0.0 &
```
Wait a few seconds for it to build.
**Check ChromeDriver:**
```bash
cat /tmp/chromedriver_port 2>/dev/null || echo "not running"
```
If not running, start it:
```bash
./browser.sh chromedriver
```
This finds Chrome automatically and starts ChromeDriver on a free port.
### Step 2: Take Screenshots
Use `./browser.sh` for browser automation:
```bash
./browser.sh start http://localhost:4000/
./browser.sh screenshot /tmp/preview.png
./browser.sh dark
./browser.sh screenshot /tmp/preview-dark.png
./browser.sh mobile
./browser.sh screenshot /tmp/preview-mobile-dark.png
./browser.sh light
./browser.sh screenshot /tmp/preview-mobile-light.png
./browser.sh desktop
./browser.sh nav http://localhost:4000/2026/course-shell/
./browser.sh screenshot /tmp/course-shell.png
./browser.sh stop
```
Mode commands (`dark`, `light`, `mobile`, `desktop`) persist until changed.
### Step 3: View Screenshots
After taking a screenshot, use the Read tool to view it:
```
Read /tmp/preview.png
```
### Inspecting Elements
Execute JavaScript to query the page:
```bash
./browser.sh js "document.querySelector('nav').getBoundingClientRect()"
```
### After Making Changes
After modifying CSS/HTML:
1. Jekyll will auto-rebuild (watch for "Regenerating:" in Jekyll output)
2. Refresh: `./browser.sh nav http://localhost:4000/`
3. Take a new screenshot to verify changes
### Common Pages to Check
- Homepage: `http://localhost:4000/`
- Current year index: `http://localhost:4000/2026/`
- Lecture page: `http://localhost:4000/2026/course-shell/`
- About page: `http://localhost:4000/about/`
### ChromeDriver Lifecycle
**Keep ChromeDriver running** across multiple previews during a session. Only kill it when no more browser interactions are expected.
- `./browser.sh stop` - Ends the browser session (optional between screenshots)
- `./browser.sh kill` - Stops ChromeDriver entirely (only when done with all design work)
You do not need to run `./browser.sh kill` after each preview. Start ChromeDriver once at the beginning and leave it running.
### Troubleshooting
**Jekyll not rebuilding:** Run `bundle exec jekyll build` manually
**ChromeDriver errors:** Kill and restart
```bash
./browser.sh kill
./browser.sh chromedriver
```
**Session errors:** Stop any existing session first
```bash
./browser.sh stop
```
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「website-preview」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次