π― Global CLI injection tool for Obsidian plugins.
npm install -g obsidian-plugin-confignpm install -g obsidian-plugin-config@latest --force# Inject in current plugin directory
# Prompts for confirmation before replacing each existing file
obsidian-inject
# Inject by path
# Prompts for confirmation before replacing each existing file
obsidian-inject ../my-plugin
# Inject without confirmation
# Auto-confirms all file replacements (no prompts)
obsidian-inject ../my-plugin --no
# Inject with SASS support
# Adds esbuild-sass-plugin dependency and SCSS compilation
obsidian-inject ../my-plugin --sass
# Verification only (dry-run)
# Shows what would be injected without making any changes
obsidian-inject ../my-plugin --dry-run
# Help
obsidian-inject --help--no,-n- Skip confirmation prompts (auto-confirm)--sass- Add SASS support (esbuild-sass-plugin)--dry-run- Verification only (no changes)
- β
Standalone local scripts:
esbuild.config.ts,acp.ts,update-version.ts,release.ts,help.ts,utils.ts - β package.json: scripts, dependencies, yarn protection
- β tsconfig.json: modern optimized TypeScript configuration
- β eslint.config.mts: ESLint flat config
- β
Config files:
.editorconfig,.prettierrc,.npmrc,.env,.vscode/settings.json,.vscode/tasks.json - β GitHub Actions: release workflow
- β
Traceability:
.injection-info.json(version, date) - π¨ SASS support: optional, via
--sassflag
yarn start # Install dependencies + start dev
yarn dev # Development build (watch mode)
yarn build # Production build
yarn real # Build + install to real vault
yarn acp # Add, commit, push
yarn bacp # Build + add, commit, push
yarn v # Update version
yarn r # GitHub release
yarn lint # ESLint check
yarn lint:fix # ESLint fix
yarn prettier # Prettier check
yarn prettier:fix # Prettier format all
yarn h # Full helpyarn upgrade # Update all dependencies to latestobsidian-inject ../my-plugin --sassWhat gets added:
- β
esbuild-sass-plugindependency - β
Automatic
.scssdetection (src/styles.scsspriority) - β CSS cleanup after compilation
Target plugins become 100% standalone after injection:
- β Scripts integrated locally (no external runtime dependency)
- β Updatable via re-injection
- β Yarn protection enforced
- β Compatible with all Obsidian plugins
After injection, your plugin has a complete development setup:
In-place development (inside vault):
- Develop directly in
.obsidian/plugins/your-plugin - Run
yarn dev- builds automatically to current location
External development (outside vault):
- Develop anywhere on your system
- Configure
.envfile with vault paths:TEST_VAULT=/path/to/test/vault REAL_VAULT=/path/to/production/vault
- Run
yarn dev- builds to TEST_VAULT - Run
yarn real- builds to REAL_VAULT
yarn start # Install dependencies + start dev
yarn dev # Watch mode (auto-rebuild on changes)
yarn build # Production build
yarn real # Build to production vaultAfter injection, VSCode tasks are available for quick access:
- Build - Production build
- Lint / Lint: Fix - ESLint check/fix
- Prettier: Check / Prettier: Fix - Format check/fix
- Obsidian Inject - Re-inject configuration (with confirmation)
- Obsidian Inject (no confirm) - Re-inject without confirmation
- Cleanup: Lint + Prettier + Build - Full cleanup sequence
π‘ Tip: Use Ctrl+Shift+B (Windows/Linux) or Cmd+Shift+B (Mac) for the default Build task.
yarn v # Update version (prompts for type)
yarn acp # Add, commit, push changes
yarn bacp # Build + add, commit, push
yarn r # Create GitHub releaseyarn lint # Check for linting errors
yarn lint:fix # Auto-fix linting errors
yarn prettier # Check formatting
yarn prettier:fix # Auto-format all filesyarn start- Install and start development- Make changes, test in Obsidian
yarn bacp- Build and commit changesyarn v- Update versionyarn r- Create release
git clone https://github.com/3C0D/obsidian-plugin-config
cd obsidian-plugin-config
yarn installyarn inject-prompt # Interactive injection
yarn inject-path ../my-plugin # Direct injection
yarn inject ../my-plugin --sass # With SASS support
yarn check-plugin ../my-plugin # Dry-run onlyyarn npm-publish # All-in-one:
# 1. Version bump
# 2. Generate bin/obsidian-inject.js
# 3. Verify package
# 4. Commit + push
# 5. Publish to NPM
# 6. Update global CLI (optional)