This document is here to help you understand the project structure and guide you through development, building, and deployment.
This extension uses:
- Handlebars for templating.
- Bootstrap for styling.
- jQuery for DOM manipulation.
- Precompiled templates for compatibility with Manifest V3 (no
'unsafe-eval'
).
Here’s what the folders and files mean:
project/
├── src/ # Source files for development
│ ├── html/ # Popup HTML + Handlebars templates (.hbs files)
│ ├── css/ # Stylesheets (CSS)
│ ├── js/ # JavaScript files (core functionality) + libs
│ ├── manifest.json # Chrome extension manifest
│
├── dist/ # Final extension files for deployment (auto-generated)
│ ├── css/ # CSS files
│ ├── js/ # JavaScript (includes precompiled templates)
│ ├── html/ # Static HTML files (e.g., popup.html)
│ ├── fonts/ # Font assets
│ ├── icon/ # Extension icons
│ └── manifest.json # Final manifest file
│
├── build.js # Script to build the extension
├── package.json # Development setup (precompile Handlebars templates)
└── README.md # This documentation
To get started, you need:
- Node.js (for development tools).
Install the necessary dependencies:
npm install
This installs the Handlebars CLI for precompiling templates.
Make your changes in the src/
folder:
- Update
.hbs
files insrc/html/
for templating. - Modify CSS in
src/css/
. - Add or update JavaScript in
src/js/
.
Whenever you’re done with changes, run this command:
npm run build
This does three things:
- Precompiles Handlebars templates: Converts
.hbs
files intotables.js
. - Cleans the
dist/
folder: Ensures no old files are left. - Copies necessary files into the
dist/
folder.
After the build, your final extension is in the dist/
folder.
- Open Chrome and go to
chrome://extensions/
. - Enable Developer Mode (toggle in the top-right).
- Click "Load unpacked" and select the
dist/
folder.
Now, your extension is loaded into Chrome for testing.
When you’re ready to share or publish the extension:
- Zip the contents of the
dist/
folder:cd dist zip -r ../chrome-extension.zip .
- Upload the
chrome-extension.zip
file to the Chrome Web Store.
-
Precompiled Templates:
- Templates are precompiled during the build process to ensure compatibility with Manifest V3.
- The
.hbs
files insrc/html/
are converted intotables.js
.
-
Clean Build:
- The
dist/
folder contains only the files required for the extension to work. - No unnecessary dev files like
.hbs
ornode_modules
.
- The
-
Automated Process:
- The
npm run build
command handles everything for you—cleaning, precompiling, and copying files.
- The
Run:
npm run build
This updates the precompiled templates and copies everything to the dist/
folder.
No. Manifest V3 requires precompiled templates, so always test using the files in dist/
.
The dist/
folder contains:
- CSS files: For styling the extension.
- JavaScript files: Includes your code and precompiled templates.
- HTML files: Static files like
popup.html
. - Fonts and icons: Assets for your extension.
- Manifest.json: The required file for Chrome extensions.