🎨 chromatic
A Google Chrome Extension boilerplate built with React, Tailwind CSS, and TypeScript.
Installation
# Clone the repository
git clone <your-repo-url>
# Install dependencies
npm install
# Start development build with watch mode
npm run watch
Loading the Extension
- Open Google Chrome
- Navigate to chrome://extensions/
- Enable "Developer mode" in the top right
- Click "Load unpacked"
- Select the dist directory from your project
The extension should now appear in your browser toolbar.
Development Workflow
Building the Extension
# Production build
npm run build
# Development build with watch mode
npm run watch
Testing Changes
- Make your code changes
- If using watch mode, changes will rebuild automatically
- Go to chrome://extensions/
- Click the refresh icon on your extension card
- Test the updated extension
Debugging
- Click on the extension icon
- Right-click on the popup
- Select "Inspect"
- Use Chrome DevTools for debugging
Background Script Debugging
- Go to chrome://extensions/
- Click "Details" on your extension
- Find "Inspect views: service worker"
- Use Chrome DevTools for debugging
Content Script Debugging
- Open DevTools on any webpage
- Go to "Sources" tab
- Look for your extension ID in the left sidebar
- Find your content scripts under the extension files
Deployment
Building for Production
# Clean install dependencies
npm ci
# Build for production
npm run build
Creating a Package
- Ensure your manifest.json has the correct version
- Create a ZIP file of your dist directory
- Remove any unnecessary files from the ZIP
- Make sure the ZIP is under 10MB
Chrome Web Store Submission
Go to Chrome Developer Dashboard
Create a new item
Fill in required information:
- Description
- Screenshots
- Icon
- Privacy policy
Upload your ZIP file
Submit for review
Best Practices
- Minimize extension size
- Use event-driven background scripts
- Avoid unnecessary content script injections
- Implement caching where appropriate
Security
- Follow Content Security Policy guidelines
- Minimize required permissions
- Sanitize user input
- Use secure storage for sensitive data
Code Quality
- Follow Chrome extension best practices