astrolock preview
Previews the production build of your site locally before deploying.
Usage
# Build first, then preview
astrolock build
astrolock preview
What It Does
The preview command:
- Serves dist/ - Shows exactly what will be deployed
- Simulates production - No dev tools, optimized assets
- Tests functionality - Verify links, search, navigation
- Checks performance - See actual load times
$ astrolock preview
Previewing production build...
✓ Loading dist/ directory
✓ Server started
🚀 Preview at http://localhost:4321
Testing your production build
Press Ctrl+C to stopWarning
Always preview before deploying to catch broken links, missing images, or other issues.
Why Preview?
Preview catches issues before deployment:
- Broken links
- Missing images
- Search index issues
- Navigation problems
- Style issues
- JavaScript errors
Preview vs Development
| Feature | preview | write |
|---|---|---|
| Source | dist/ (built) | src/ (source) |
| Optimization | Full | Minimal |
| Hot reload | No | Yes |
| What you see | Production | Development |
What to Test
Navigation
- ✅ All menu links work
- ✅ Breadcrumbs correct
- ✅ Pagination works
- ✅ Category/tag links function
Content
- ✅ All pages load
- ✅ Posts display correctly
- ✅ Media items show properly
- ✅ Authors pages work
Media
- ✅ Images load and display
- ✅ Audio players work
- ✅ Video players function
Features
- ✅ Search works
- ✅ Dark mode toggles
- ✅ RSS feed generates
Performance
- ✅ Pages load quickly
- ✅ No console errors
Common Issues
- Build Not Found
- Outdated Content
- Links Broken
- Search Not Working
Error: dist/ directory not foundFix: Build first:
astrolock build
astrolock previewPreview shows old content.
Fix: Rebuild:
rm -rf dist/
astrolock build
astrolock previewFix: Check base URL in .astrolock/astrolock.yaml:
site:
base_url: https://yoursite.comFix: Check search file exists:
cat .json/search.jsonRebuild if missing:
astrolock buildError: dist/ directory not foundFix: Build first:
astrolock build
astrolock previewPreview shows old content.
Fix: Rebuild:
rm -rf dist/
astrolock build
astrolock previewFix: Check base URL in .astrolock/astrolock.yaml:
site:
base_url: https://yoursite.comFix: Check search file exists:
cat .json/search.jsonRebuild if missing:
astrolock buildDesktop Browsers
Test in: Chrome, Firefox, Safari, Edge
Mobile Testing
- Browser resize: Open DevTools → Toggle device toolbar
- Responsive breakpoints:
- 320px - Small phones
- 375px - iPhone SE
- 768px - Tablets
- 1024px - Small laptops
- 1440px - Desktops
Best Practices
-
Always preview before deploy
astrolock build && astrolock preview -
Fresh builds for production
rm -rf dist/ .json/ astrolock build astrolock preview -
Check browser console for errors
-
Test user journeys:
- Homepage → Blog → Post
- Homepage → Media → Play Audio
- Homepage → Search → Results
See Also
- astrolock build - Build your site
- astrolock write - Development server
- astrolock deploy - Deploy your site
Tip
Spend 5-10 minutes testing: click menu items, test search, open posts, play media, check mobile view.