Theme Development Workflow
# Theme Development Workflow This guide provides a step-by-step workflow for developing themes in FearlessCMS, from initial setup to final deployment. ## Prerequisites Before starting theme development, ensure you have: - A working FearlessCMS installation - Basic knowledge of HTML, CSS, and JavaScript - A code editor (VS Code, Sublime Text, etc.) - Basic understanding of responsive design principles ## Development Environment Setup ### 1. Create Theme Directory ```bash # Navigate to your FearlessCMS themes directory cd themes/ # Create your theme directory mkdir my-theme cd my-theme # Create required subdirectories mkdir templates mkdir assets mkdir assets/images mkdir assets/js ``` ### 2. Initialize Theme Files Create the basic theme structure: ```bash # Create theme configuration touch theme.json touch config.json touch README.md # Create template files touch templates/home.html touch templates/page.html touch templates/blog.html touch templates/404.html # Create assets touch assets/style.css # Placeholder for thumbnail (add actual image later) # thumbnail.png or screenshot.png will go here touch assets/theme.js ``` ## Step-by-Step Development Process ### Step 1: Define Theme Configuration Start by creating your `theme.json`: ```json { "name": "My Awesome Theme", "description": "A modern, responsive theme for blogs and websites", "version": "1.0.0", "author": "Your Name", "license": "MIT", "templates": { "home": "home.html", "page": "page.html", "blog": "blog.html", "404": "404.html" } } ``` ### Step 2: Create Basic Templates Start with a simple `templates/page.html`: ```html{{title}}
{{module=sidebar.html}}
Debug Info:
Title: {{title}}
URL: {{url}}
Theme: {{theme}}
Children: {{#if children}}Yes{{else}}No{{/if}}
```
### 3. Check File Permissions
Ensure your theme files have proper permissions:
```bash
chmod 644 assets/style.css
chmod 644 templates/*.html
chmod 644 theme.json
chmod 644 config.json
```
## Version Control
### 1. Initialize Git Repository
```bash
cd themes/my-theme
git init
```
### 2. Create .gitignore
```bash
# .gitignore
.DS_Store
*.log
node_modules/
# Add any build tool directories if you use them
# .sass-cache/
# dist/
# build/
```
### 3. Make Initial Commit
```bash
git add .
git commit -m "Initial theme commit"
```
## Creating Theme Thumbnails
Before deploying your theme, create a thumbnail image for the admin panel preview:
### 1. Prepare Your Theme for Screenshot
```bash
# Ensure theme is active and properly styled
# Add sample content to showcase the theme
# Test at desktop resolution (1200px+ width)
```
### 2. Capture the Thumbnail
1. **Open your theme** in a browser at desktop resolution
2. **Navigate to homepage** or most representative page
3. **Take a screenshot** of the full viewport
4. **Crop to 1200x675px** (16:9 aspect ratio)
5. **Optimize the image** to keep under 500KB
6. **Save as `thumbnail.png`** in your theme root directory
### 3. Thumbnail Best Practices
```bash
# Good thumbnail characteristics:
# - Shows homepage or main layout
# - High resolution and clear quality
# - Realistic sample content (not Lorem Ipsum)
# - Proper lighting and contrast
# - Highlights theme's unique features
```
### 4. Test Thumbnail Display
1. **Refresh admin panel** to see the thumbnail
2. **Check grid layout** - ensure it displays properly
3. **Test modal view** - click to view larger version
4. **Verify fallback** - temporarily rename file to test placeholder
### 5. Thumbnail File Requirements
- **Filename**: `thumbnail.png`, `thumbnail.jpg`, `screenshot.png`, or `screenshot.jpg`
- **Dimensions**: 1200x675px (recommended)
- **Format**: PNG (preferred), JPG, JPEG, GIF, or WebP
- **Size**: Under 500KB for optimal performance
- **Location**: Theme root directory (same level as config.json)
## Deployment
### 1. Package Your Theme
Create a clean distribution:
```bash
# Verify thumbnail is present
ls -la thumbnail.png # or thumbnail.jpg, screenshot.png, etc.
# Remove development files
rm -rf .git
rm -rf node_modules
# Remove any build tool directories
# rm -rf .sass-cache
# rm -rf dist
# rm -rf build
# Create zip file (include thumbnail)
zip -r my-theme-v1.0.0.zip . -x "*.git*" "node_modules/*"
```
### 2. Install in FearlessCMS
1. **Upload** the theme to your FearlessCMS installation
2. **Extract** to the `themes/` directory
3. **Verify thumbnail** appears in admin themes section
4. **Activate** the theme in admin panel
5. **Configure** theme options
6. **Test** thoroughly
## Maintenance
### 1. Keep Dependencies Updated
Regularly update any external dependencies:
- CSS frameworks
- JavaScript libraries
- Font files
### 2. Monitor Performance
Track theme performance over time:
- Page load speeds
- User feedback
- Browser compatibility issues
### 3. Version Management
Use semantic versioning for your theme:
- **Major version** (1.0.0 → 2.0.0): Breaking changes
- **Minor version** (1.0.0 → 1.1.0): New features
- **Patch version** (1.0.0 → 1.0.1): Bug fixes
## Example: Complete Development Session
Here's an example of a complete development session:
```bash
# 1. Create theme structure
mkdir -p themes/my-blog-theme/{templates,assets/{css,js,images}}
# 2. Create basic files
cd themes/my-blog-theme
touch theme.json config.json README.md
touch templates/{home,page,blog,404}.html
touch assets/css/style.css assets/js/theme.js
# 3. Edit theme.json
cat > theme.json << 'EOF'
{
"name": "My Blog Theme",
"description": "A clean blog theme",
"version": "1.0.0",
"author": "Your Name",
"license": "MIT",
"templates": {
"home": "home.html",
"page": "page.html",
"blog": "blog.html",
"404": "404.html"
}
}
EOF
# 4. Create basic template
cat > templates/page.html << 'EOF'
Title: {{title}}
URL: {{url}}
Theme: {{theme}}
Children: {{#if children}}Yes{{else}}No{{/if}}