HTML Structure
Use Semantic HTML
Keep Structure Flat
Avoid deeply nested elements that complicate styling:CSS Guidelines
Use Classes, Not IDs
Classes are reusable and have consistent specificity:Define a Base Style
Start with consistent defaults:Use CSS Variables
Make theming and updates easier:Print-Specific Styles
Optimize for print output:Data Handling
Always Handle Missing Data
Use defaults and conditionals:Validate Data Types
Ensure data is the expected type:Test Edge Cases
Test your template with:- Empty strings and null values
- Empty arrays
- Very long text
- Large numbers
- Special characters
- Missing optional fields
Performance
Optimize Images
Minimize External Resources
Keep Templates Focused
Create separate templates for different document types rather than one complex template with many conditionals.Fonts
Use Web-Safe Fonts or Google Fonts
Fileloom automatically injects common fonts, but for custom fonts:Provide Fallbacks
Limit Font Weights
Only load weights you need:Tables
Use Proper Table Structure
Style Tables for Print
Maintainability
Comment Complex Logic
Use Consistent Naming
Document Your Templates
Add a comment block at the top:Checklist
Before publishing a template:- Test with real data from your application
- Verify all variables have default handling
- Check empty array scenarios
- Test with long text content
- Verify page breaks look correct
- Check on different paper sizes
- Validate all links and images load
- Review with fresh eyes or a colleague

