Set up a local development environment and run the ThemePlus build pipeline.
Overview
ThemePlus uses a hybrid build architecture β Vite handles SCSS compilation with HMR in development, and webpack via @wordpress/scripts handles the React admin panel and generates the WordPress dependency manifest. Both pipelines run in parallel during development.
This article is for contributors who want to modify ThemePlus source files. Theme developers integrating ThemePlus into a theme do not need any build tooling.
Requirements
| Tool | Minimum Version |
|---|---|
| Node.js | 20.19+ or 22.12+ |
| npm | 9.0.0 |
| PHP | 8.0 |
| WordPress | 6.8 |
| Local WordPress environment | Local by Flywheel recommended |
Vite 7 requires Node.js 20.19+ or 22.12+ β Node.js 18 reached end-of-life in April 2025 and is no longer supported. Use
node --versionto check your current version and upgrade via nodejs.org if needed.
Repository Setup
1. Clone into your plugins folder
cd wp-content/plugins
git clone https://github.com/fronttheme/themeplus.git
cd themeplus2. Install dependencies
npm install
3. Enable dev mode constants in wp-config.php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_ENVIRONMENT_TYPE', 'local' );
define( 'THEMEPLUS_DEV', true );
THEMEPLUS_DEVmust be defined inwp-config.phpβ not infunctions.php. It must be a booleantrue, not a string.
4. Activate the plugin
Go to Plugins β Installed Plugins in the WordPress admin and activate ThemePlus. Then activate the ThemePlus Demo theme β this gives you a full field registration to develop against.
Running Dev Mode
Dev mode requires two terminal processes running simultaneously β one for each build pipeline.
Terminal 1 β Vite (SCSS with HMR):
npm run dev
Starts the Vite dev server on port 3000. Watches src/scss/ for changes and hot-reloads the admin panel styles without a page reload.
Terminal 2 β wp-scripts (React/JSX):
npm run blocks:start
Starts the webpack watcher. Recompiles src/js/admin/ on save and outputs assets/js/admin.js + assets/js/admin.asset.php.
Both watchers must be running simultaneously for all changes to be reflected β Vite handles styles, wp-scripts handles JavaScript.
Build Architecture
| Tool | Handles | Input | Output |
|---|---|---|---|
| Vite | SCSS β CSS (with HMR in dev) | src/scss/admin.scss | assets/css/admin.css |
| webpack / wp-scripts | React/JSX β JS + dependency manifest | src/js/admin/index.js | assets/js/admin.js + assets/js/admin.asset.php |
admin.asset.php is generated automatically by wp-scripts β it contains a content-hash version string and the full WordPress dependency array (wp-components, wp-element, wp-api-fetch, wp-i18n, react). The plugin reads this file in production for correct cache busting.
Available Scripts
| Script | Command | Description |
|---|---|---|
| Dev β Vite | npm run dev | Starts Vite dev server with HMR for SCSS |
| Dev β React | npm run blocks:start | Starts webpack watcher for JS/React |
| Build β Vite | npm run build | Production build of SCSS β CSS |
| Build β React | npm run blocks:build | Production build of React β JS |
| Generate .pot | npm run pot | Regenerates languages/themeplus.pot |
| Package | npm run package | Runs both builds + pot + creates themeplus.zip |
Project Structure
themeplus/
βββ src/
β βββ js/admin/ # React admin panel source
β β βββ components/
β β β βββ Fields/ # One file per field type (30 components)
β β β βββ Common/ # FieldRenderer, Dialog, Select, SearchResults
β β β βββ Layout/ # Sidebar, Header, Body, Footer, MainWrapper
β β β βββ Sections/ # Import/Export, Custom Font Uploader
β β β βββ DevPanel/ # Developer Panel components
β β βββ context/ # React Context β Settings, Theme
β β βββ hooks/ # Custom React hooks
β β βββ services/ # Google Fonts and Custom Fonts API services
β β βββ utils/ # fieldHelpers.js β conditional logic evaluation
β β βββ App.jsx # Root application component
β βββ scss/ # SCSS source β 7-1 modular architecture
βββ assets/ # Compiled output (do not edit directly)
β βββ css/admin.css # Built by Vite
β βββ js/admin.js # Built by wp-scripts
β βββ js/admin.asset.php # wp-scripts dependency manifest
β βββ fonts/fontawesome/ # Bundled FontAwesome 7
βββ includes/ # PHP framework classes
β βββ classes/core/ # Core framework classes
β βββ classes/custom-fonts/ # Custom Fonts module
β βββ config/ # sample-config.php, default-config.php
β βββ functions/ # Public helper functions
βββ languages/ # themeplus.pot + translations
βββ themeplus.php # Plugin entry point
βββ uninstall.php # Clean removal routine
βββ package.json
βββ vite.config.mjs
βββ webpack.config.js
βββ .distignore # Files excluded from the release ZIP
βββ .gitignoreBuilding for Production
Run all build steps in order:
npm run build # SCSS β assets/css/admin.css
npm run blocks:build # React β assets/js/admin.js + admin.asset.php
npm run pot # Regenerate languages/themeplus.pot
npm run package # Creates package/themeplus.zipOr run everything in one command:
npm run package
npm run package runs both builds and the pot generation, then creates a clean ZIP at package/themeplus.zip excluding source files, dev tooling, and git artifacts per .distignore. This ZIP is the distributable plugin β attach it to a GitHub Release or upload to WordPress.org.
Whatβs excluded from the package ZIP
The .distignore file controls what is excluded:
src/
node_modules/
package.json
package-lock.json
vite.config.mjs
webpack.config.js
.git/
.gitignore
.gitattributes
.distignore
.github/
*.map
README.md
CHANGELOG.md
CONTRIBUTING.md
SECURITY.md
Dev Mode Behaviors
When dev mode is active (see detection logic below), ThemePlus enables:
Dev Mode Detection
ThemePlus detects dev mode automatically using this priority order:
You do not need to configure dev mode in your themeβs themeplus_framework_config() β it is detected automatically behind the scenes.
Adding a New Field Type
See CONTRIBUTING.md for the full six-step guide.