This is a Vue sample plugin for Obsidian, and it should help get you started developing with TypeScript and Vue 3 in ESbuild.
This template depends on the latest Obsidian API: obsidian.d.ts
.
Note: The Obsidian API is still in early alpha and is subject to change at any time!
- Check if someone already developed a plugin for what you want! There might be an existing plugin similar enough that you can partner up with.
- Make a copy of this repo as a template with the "Use this template" button (login to GitHub if you do not see it).
- Clone your repo to a local development folder. For convenience, you can place this folder in the
.obsidian/plugins
folder. - Install Node.js, then run
npm run chore
ornpm install
to install the package dependencies. - Run
npm run dev
to compile your plugin tomain.js
andstyles.css
in a development mode. In this time, make changes to your TypeScript or Vue 3 code in thesrc
folder, they will be automatically compiled tomain.js
andstyles.css
. - Reload Obsidian to load the newest version of your plugin, then enable your plugin in the Obsidian settings window.
- Run
npm run build
to compile your plugin tomain.js
andstyles.css
in a release mode.
- Obsidian API.
- Obsidian Plugin Developer Docs (author: marcusolsson).
- Obsidian Plugin 中文开发文档 (translator: luhaifeng666).
MIT license.
这是一个基于 Vue 的 Obsidian 插件开发模板, 它应该有助于您使用 TypeScript 和 Vue 3 同时搭配 ESbuild 进行开发.
此模板依赖于最新的 Obsidian API: obsidian.d.ts
.
请注意: Obsidian API 目前仍处于早期的 alpha 阶段, 因此随时都有可能发生变动!
- 检查是否有人已经为您想要的东西开发了插件! 可能已经有了一个跟您预期足够相似的现有插件, 您可以和它的开发者进行合作.
- 使用 "Use this template" 按钮将此仓库复制一份 (如果您没有看到这个按钮, 请先登录 GitHub).
- 将您的仓库克隆到本地. 为了方便起见, 您可以将仓库放到
.obsidian/plugins
文件夹中. - 安装 Node.js, 然后运行
npm run chore
或npm install
安装项目依赖. - 运行
npm run dev
可以在开发模式下将插件编译为main.js
和styles.css
文件. 此时修改src
文件夹中的 TypeScript 或 Vue 3 代码都可以自动热更新到main.js
和styles.css
文件中. - 重新启动 Obsidian 以加载最新版本的插件, 然后在 Obsidian 的设置窗口中启用插件.
- 运行
npm run build
可以在发布模式下将插件编译为main.js
和styles.css
文件.
- Obsidian API.
- Obsidian Plugin Developer Docs (作者: marcusolsson).
- Obsidian Plugin 中文开发文档 (译者: luhaifeng666).
MIT 开源许可协议.