papacore dev
Start development mode with file watching, automatic building, and hot-reload.
Usage
papacore dev
Or via npm/pnpm scripts:
npm run dev
# or
pnpm dev
What It Does
The dev command runs three processes simultaneously:
- Build: Transforms your TypeScript/Preact components to Datacore format
- Watch: Monitors your
src/directory for file changes - Install: Copies built files to your vault
- Hot-Reload: Updates timestamps to trigger Obsidian reload
Features
Automatic Rebuilding
When you save any file in src/, Papacore:
- Detects the change instantly
- Rebuilds only the affected files
- Transforms imports/exports to Datacore format
- Copies the updated files to your vault
Hot Reloading
For view files (.tsx files in src/Datacore/views/):
- Papacore updates a timestamp in the markdown file
- Obsidian detects the change and reloads the view
- You see your changes immediately without manual refresh
CSS Processing
Changes to src/styles.css:
- Processes through Tailwind CSS v4
- Generates utility classes for all Tailwind usage
- Updates
papacore.cssin your vault - Applies styles immediately in Obsidian
Story Files
Component story files (.stories.tsx):
- Generate markdown preview files
- Create isolated component showcases
- Update automatically when stories change
Workflow
-
Start dev mode:
npm run dev -
Open Obsidian and navigate to your views
-
Edit components in your IDE:
// src/Datacore/components/shared/button.tsx
export function Button({ children }) {
return <button className="px-4 py-2 bg-blue-500">{children}</button>
} -
Save the file - changes appear in Obsidian instantly
-
Press
Ctrl+Cto stop dev mode
File Watching
Watched Directories
src/Datacore/components/- Component filessrc/Datacore/views/- View filessrc/Datacore/utils/- Utility filessrc/styles.css- Stylesheet
Ignored Files
dist/- Build outputnode_modules/- Dependencies.git/- Git metadata- Files starting with
.
Performance
Dev mode is optimized for speed:
- Only rebuilds changed files
- Uses incremental compilation
- Minimal transformation overhead
- Fast file watching with Chokidar
Troubleshooting
Changes Not Appearing
If changes don't appear in Obsidian:
- Check the terminal for build errors
- Verify
papacore.jsonhas correctvaultPath - Make sure the CSS snippet is enabled in Obsidian
- Try reloading Obsidian manually
Build Errors
If you see build errors:
- Check your TypeScript syntax
- Verify all imports are correct
- Make sure you're using Preact (not React)
- Check the error message for details
Performance Issues
If dev mode is slow:
- Reduce the number of files being watched
- Close other resource-intensive applications
- Check your disk space
- Restart dev mode
Related Commands
papacore build- Build once without watching