🍱 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 build
Options:
-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 watch
Create a default configuration file:
npx bento init
Bento 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.