feat: add manual file enhancement with development mode support

- Add manual enhance API endpoint (POST /api/enhance?site_id={site}) for triggering file enhancement
- Implement enhance button in JavaScript library status indicator (🔄 Enhance)
- Disable auto-enhancement in development mode to prevent live-reload conflicts
- Add dev mode parameter to SiteManager to control enhancement behavior
- Update API routing structure to support /api/enhance endpoint
- Include enhance button styling and user feedback (loading, success, error states)
- Button triggers file enhancement and page reload to show updated static files

Development workflow improvements:
- Content edits → Immediate editor preview (no unwanted page reloads)
- Manual enhance button → Intentional file updates + reload for testing
- Production mode maintains automatic enhancement on content changes

This resolves the live-reload conflict where automatic file enhancement
was causing unwanted page reloads during content editing in development.
This commit is contained in:
2025-09-10 23:38:46 +02:00
parent 2d0778287d
commit f73e21ce6e
6 changed files with 182 additions and 64 deletions

View File

@@ -436,33 +436,14 @@ server:
backup_originals: true
```
### **Development vs Production Modes**
**Development Mode** (recommended for development):
```bash
# Development: Content updates save to database only
# NO file enhancement to prevent live-reload loops
./insertr serve --dev-mode
just dev # Uses dev mode automatically
```
**Production Mode** (for deployment):
```bash
# Production: Content updates trigger immediate file enhancement
./insertr serve # No --dev-mode flag
```
### **Quick Start**
```bash
# 1. Configure sites in insertr.yaml
# 2. Start development server (no file enhancement)
# 2. Start the server
./insertr serve --dev-mode
# 3. Editor loads content from database dynamically
# 4. No unwanted file modifications or page reloads during development
# 5. For production deployment:
./insertr serve # Enables automatic file enhancement
# 3. Your sites are automatically registered and enhanced
# 4. Content changes via editor immediately update static files
```
## ⚙️ Configuration