Basecoat is a simple WordPress starter theme designed for building block themes, featuring a development workflow with pre-made PHP includes for CSS and JS on both the front-end and Gutenberg editor, PHP linting, a modern npm/esbuild workflow, and a zip export function for easy manual deployment.
- PHP 7.4 or higher (tested up to PHP 8.4)
- Composer
- Node.js & npm
- WordPress >= 6.0
Clone the repository and install the dependencies:
composer install
npm install --devBasecoat enforces strict coding standards and static analysis to avoid bugs and maintain clean code.
Run PHP linting with:
composer run lint:phpThis will:
- Use PHP CS Fixer to automatically fix code style issues.
- Use PHPStan for static analysis and bug detection.
Lint your JavaScript files using ESLint:
npm run lint-jsThis will:
- Check for code quality and consistency.
- Automatically fix some issues using Prettier & ESLint.
Lint SCSS files with Prettier:
npm run lint-scssThis will:
- Format SCSS code according to a consistent style.
- Automatically fix code style issues where possible.
Format Theme.json file with Prettier:
npm run format-theme-jsonThis will:
- Format Theme.json file according to a consistent style.
npm scripts are used to automate tasks such as compiling SCSS, linting code, generating translations, and creating a zip archive of the theme. Below are the key build commands:
Compile SCSS files into CSS using esbuild, generating sourcemaps for easier debugging.
npm run build-cssThis will:
- Compile SCSS files into minified CSS (theme.css).
- Create source maps for easier debugging (theme.css.map).
- Process CSS with PostCSS (autoprefixer, media query optimization, etc.).
Process JavaScript files (currently only linting, no compilation).
npm run build-jsThis will:
- Lint JavaScript files for code quality and consistency.
Generate translation files (.pot) for internationalization.
npm run build-i18nThis will:
- Generate or update the
.pottranslation file in thelanguages/directory. - Use WP-CLI to extract translatable strings from PHP files.
Watch SCSS files and trigger the build task automatically.
npm run watchor
npm run watch-scssThis will:
- Watch all SCSS files in the
assets/scss/directory for changes. - Trigger a rebuild of the CSS whenever a change is detected.
Run the complete build process (linting, building, and packaging).
npm run buildor
npm run defaultThis will:
- Lint SCSS files
- Build CSS
- Lint JavaScript
- Lint PHP
- Format theme.json
- Generate translations
- Create a zip archive of the theme
Create a zip archive of the theme.
npm run zip-themeThis will:
- Create a
.ziparchive of the theme, excluding unnecessary files likenode_modulesand.git. - Save the archive in the root directory of the project (e.g.,
basecoat.zip).
Once the zip file is created, you can upload it to a WordPress site:
- Log in to the WordPress admin dashboard.
- Navigate to Appearance > Themes.
- Click Add New and then click Upload Theme.
- Choose the zip file (
basecoat.zip) generated by Gulp and click Install Now. - After installation, click Activate to use the theme.
Basecoat is licensed under the GPL-2.0-or-later license. See the LICENSE file for more details.