Prerequisites
Before creating a theme, ensure you have:- An EverShop project set up and running
- Node.js and npm installed
- Basic knowledge of React and TypeScript
Creating a New Theme
EverShop provides a CLI command to scaffold a new theme with all necessary files:Enter your theme name
When prompted, enter a name for your theme:
Theme names can only contain:
- Letters (A-Z, a-z)
- Numbers (0-9)
- Dashes (-)
- Underscores (_)
Theme files are created
The command will create a new theme directory with the following structure:You’ll see a success message:
Activate your theme
Activate the newly created theme:Select your theme from the list, and choose to run the build when prompted.
Generated Theme Files
Let’s explore what thetheme:create command generates:
package.json
A minimalpackage.json for your theme:
tsconfig.json
TypeScript configuration with React support and path aliases:Default Component
A sample homepage component:Understanding Component Layout
Every theme component exports alayout object that defines:
- areaId: Where the component appears on the page (e.g., ‘content’, ‘header’, ‘footer’)
- sortOrder: The component’s position within that area (lower numbers appear first)
Common Issues
Theme name already exists
Theme name already exists
If you see the error
Theme 'name' already exists, choose a different name or delete the existing theme directory first.Invalid theme name
Invalid theme name
Ensure your theme name only contains alphanumeric characters, dashes, or underscores. Special characters and spaces are not allowed.
Component not showing on page
Component not showing on page
Make sure you’ve:
- Activated the theme using
npm run theme:active - Run
npm run buildto compile the theme - Restarted your development server
Next Steps
Now that you’ve created a theme, learn how to:Theme Structure
Explore the complete theme directory structure
Customize Your Theme
Add styling and override existing components