π± A custom bundler specifically designed for WordPress plugins - like Vite but for WordPress.
- π WordPress-focused: Built specifically for WordPress plugin development
- π¦ Dual output: Creates both minified and unminified versions of all assets
- π― Zero config: Works out of the box with sensible defaults
- π Watch mode: Automatic rebuilding on file changes
- π¨ SCSS/Sass support: Built-in CSS preprocessing
- β‘ ES6+ transpilation: Modern JavaScript support with Babel
- π Smart manifest: Asset tracking for WordPress integration
- π§Ή Clean builds: Automatic output directory cleaning
npm install @ignitekit/bento --save-dev-
Initialize configuration:
npx bento init
-
Build your assets:
npx bento build
-
Watch for changes:
npx bento watch
Bento expects your WordPress plugin to follow this structure:
your-plugin/
βββ scripts/
β βββ admin/ # Admin-specific JS/CSS
β βββ frontend/ # Frontend JS/CSS
β βββ shared/ # Shared utilities
βββ public/ # Generated assets (output)
βββ bento.conf.js
βββ package.json
Create a bento.conf.js file in your plugin root:
module.exports = {
// Entry points - directories containing your source files
entry: {
admin: 'scripts/admin',
frontend: 'scripts/frontend',
shared: 'scripts/shared'
},
// Output directory where built files will be placed
output: 'public',
// Build options
clean: true, // Clean output directory before build
// WordPress specific options
wordpress: {
textDomain: 'your-plugin-textdomain',
generateHandles: true,
wpCodingStandards: true
},
// Advanced options
advanced: {
autoInstallDeps: true,
transpile: {
target: 'es5',
browsers: ['> 1%', 'last 2 versions', 'ie >= 11']
},
css: {
autoprefixer: true,
purgeUnused: false
},
optimization: {
splitChunks: true,
treeshake: true,
compress: true
}
}
};Build assets for production and development:
npx bento buildOptions:
-c, --config <path>- Custom config file path-w, --watch- Watch for changes--no-clean- Skip cleaning output directory
Watch for changes and rebuild automatically:
npx bento watchCreate a default configuration file:
npx bento initBento creates both versions of every asset:
- Development files (
.js,.css) - Unminified, readable - Production files (
.min.js,.min.css) - Minified, optimized
public/
βββ admin/
β βββ main.js # Unminified
β βββ main.min.js # Minified
β βββ main.css # Unminified
β βββ main.min.css # Minified
βββ frontend/
β βββ ...
βββ shared/
β βββ ...
βββ manifest.json # Asset mapping
Bento generates a manifest.json file that maps source files to their built versions:
{
"main.js": {
"unminified": "main.js",
"minified": "main.min.js"
},
"main.scss": {
"unminified": "main.css",
"minified": "main.min.css"
}
}Use this manifest in your WordPress plugin to conditionally load minified or unminified assets based on WP_DEBUG or other conditions.
Add these scripts to your plugin's package.json:
{
"scripts": {
"build": "bento build",
"watch": "bento watch",
"dev": "bento watch"
}
}- Node.js >= 14.0.0
- chokidar (for watch mode)
sass- For SCSS/Sass processing@babel/core+@babel/preset-env- For ES6+ transpilation
Install optional dependencies if needed:
npm install sass @babel/core @babel/preset-env --save-dev| Feature | Bento | Vite |
|---|---|---|
| WordPress-focused | β | β |
| Dual output (min/unmin) | β | β |
| Zero config for WP | β | β |
| Dev server | β | β |
| HMR | β | β |
| File size | Lightweight | Heavier |
Just like a bento box neatly organizes different foods in compartments, Bento bundler neatly organizes your WordPress plugin assets into admin, frontend, and shared compartments! π±
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License - see LICENSE file for details.
- π Report bugs
- π‘ Request features
- π Documentation