Performance & Cleanup
Boilerplate removes unnecessary WordPress front-end output, compiles optimized assets, handles theme font assets through the build system, and provides lightweight lazy-loading support for images.
Primary Files
functions.php– theme setup, cleanup hooks, and performance-related WordPress removalsconfig.php– feature flags controlling cleanup behaviorassets/js/lazy.js– lightweight lazy-loading supportassets/js/main.js– imports lazy loading into the front-end JS bundlevite.config.mjs– minification, font copying, sourcemaps, and output configurationpackage.json– npm build commands and build dependenciesdist/– compiled JS, CSS, and font output
WordPress Head Cleanup
Boilerplate removes unnecessary default WordPress head output to keep front-end markup leaner.
Primary hooks: _bp_after_setup_theme(), _bp_init()
File: functions.php
Use this for: removing generator tags, feed links, resource hints, adjacent post links, RSD links, Windows Live Writer links, and other default head output that is not needed by most sites.
Disabled Emojis
WordPress emoji scripts and styles can be disabled when native browser emoji support is sufficient.
Config: BP_WP_EMOJI_SUPPORT_ENABLED
File: functions.php
Use this for: removing emoji detection scripts, emoji styles, feed emoji filters, email emoji filters, and the TinyMCE emoji plugin.
REST Header Links
Boilerplate removes default REST API link output from the HTML header when that discovery output is not needed on the front end.
File: functions.php
Use this for: reducing default WordPress header noise while preserving the REST API itself unless a project explicitly changes that behavior.
Minified Assets
Production builds compile optimized JS and CSS assets through Vite. JavaScript uses Terser minification and CSS is minified for production output.
Primary files: vite.config.mjs, package.json
npm run build
npm run compile
Use this for: production-ready theme assets in dist/js/ and dist/css/.
Font Asset Handling
Vite copies theme font assets into stable output paths when install asset copying is enabled.
File: vite.config.mjs
Controlled by: BP_INSTALL
dist/font/bootstrap_icons/– Bootstrap Icons font filesdist/font/open_sans/– Open Sans font files
Use this for: keeping third-party font assets self-hosted and available from predictable theme paths.
Lazy Loading
Boilerplate includes a lightweight lazy-loading script for images using the .lazy class. Modern browsers use IntersectionObserver; older browsers fall back to a throttled scroll/resize/orientation listener.
File: assets/js/lazy.js
Imported by: assets/js/main.js
Use this for: deferring image loading behavior without adding a large dependency.
Build Output
Compiled assets are emitted to stable paths under dist/.
dist/js/theme.js– front-end JavaScript bundledist/css/theme.css– front-end theme stylesheetdist/css/admin.css– WordPress admin stylesheetdist/css/editor.css– block editor stylesheetdist/font/– copied font assets
Validation Before Commit
Run cleanup-sensitive checks before committing theme changes.
git diff --check
npm run build
Use this for: confirming build output, catching whitespace issues, and reviewing asset size before deployment.