Assets Management
docmd uses a “Mirror & Map” architecture for static assets. This ensures local development file paths match compiled production build outputs seamlessly.
Directory Structure
By default, docmd processes an assets/ directory located at your project root:
my-docs/
├── assets/ # Source Assets (Images, Fonts, CSS, JS)
│ ├── css/
│ ├── js/
│ └── images/
├── docs/ # Markdown Content Files
├── docmd.config.json
└── site/ # Compiled Production Output (Auto-Mirrored)
Automatic Asset Mirroring
When executing npx @docmd/core build or npx @docmd/core dev:
- Mirroring Logic: The entire contents of
assets/are copied recursively tosite/assets/. - Build Stability: Asset copying uses a hardened, asynchronous copy engine with exponential retries to prevent filesystem locking errors on macOS and SSD volumes.
- Path References: Reference assets in Markdown and configuration files using root-relative paths:

Custom CSS & JS Integration
Link custom stylesheet or script assets across all pages via theme configuration in docmd.config.json:
docmd.config.json
{
"theme": {
"customCss": ["/assets/css/branding.css"]
},
"customJs": ["/assets/js/analytics.js"]
}
Asset Organisation for AI Indexers
- Structured Subdirectories: Keep
/css,/js, and/imagesisolated. Clean directory separation allows AI agents to locate relevant styling assets instantly. - Descriptive Filenames: Naming images
authentication-flow-diagram.pngprovides rich context to search indexers andllms.txtcrawlers compared to generic names likeimage1.png.