Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ WebDevStudios welcomes contributions and bug fixes from third-parties. Here are
- Create an [Issue](https://github.com/WebDevStudios/wds-bt/issues) so we can all discuss your idea
- Fork wds-bt
- Create a feature/hotfix branch off [main](https://github.com/WebDevStudios/wds-bt/tree/main)
- Commit code changes to your feature/hotifx branch
- Continue to merge master into your feature/hotifx branch so it stays current
- Commit code changes to your feature/hotfix branch
- Continue to merge master into your feature/hotfix branch so it stays current
- Test across all major browsers
- Accessibility testing (both WCAG 2.2AA and Section 508)
- Must pass PHPCS, ESLint, and Stylelint assertions
Expand Down
38 changes: 4 additions & 34 deletions inc/setup/dynamic-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use RecursiveIteratorIterator;
use RecursiveDirectoryIterator;

require_once dirname(__DIR__, 2) . '/tools/helpers.php';

/**
* Get all available font files from a directory.
*
Expand Down Expand Up @@ -185,7 +187,7 @@ function group_fonts_by_family( $fonts ) {
if ( ! isset( $grouped[ $family ] ) ) {
$grouped[ $family ] = array(
'name' => $family,
'slug' => get_font_slug( $family ),
'slug' => wdsbt_get_font_role_slug( $family ),
'fontFamily' => $family . ', sans-serif',
'fontFace' => array(),
);
Expand Down Expand Up @@ -235,39 +237,7 @@ function filter_theme_json_data( $theme_json_data ) {
// Get the current theme.json content.
$theme_json = $theme_json_data->get_data();

// Scan for fonts in both build and assets directories.
$build_fonts = scan_font_directory( 'build/fonts' );
$assets_fonts = scan_font_directory( 'assets/fonts' );

// Merge fonts, preferring build fonts over assets fonts.
$all_fonts = array_merge( $build_fonts, $assets_fonts );

// Remove duplicates (build fonts take precedence).
$unique_fonts = array();
$seen_paths = array();

foreach ( $all_fonts as $font ) {
$key = $font['family'] . '-' . $font['weight'] . '-' . $font['style'];
if ( ! isset( $seen_paths[ $key ] ) ) {
$unique_fonts[] = $font;
$seen_paths[ $key ] = true;
}
}

// Group fonts by family.
$font_families = group_fonts_by_family( $unique_fonts );

// Ensure typography settings exist.
if ( ! isset( $theme_json['settings']['typography'] ) ) {
$theme_json['settings']['typography'] = array();
}

// Update or add font families.
if ( ! empty( $font_families ) ) {
$theme_json['settings']['typography']['fontFamilies'] = array_values( $font_families );
}

// Create new theme JSON data object with updated content.
// Theme.json is already generated by the font build pipeline, we just need to enqueue it.
$updated_theme_json = new \WP_Theme_JSON_Data( $theme_json );

return $updated_theme_json;
Expand Down
272 changes: 136 additions & 136 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,138 +1,138 @@
{
"name": "wds-bt",
"version": "1.3.5",
"private": true,
"description": "A starter block theme from WebDevStudios.",
"author": "WebDevStudios <contact@webdevstudios.com>",
"license": "GPL-2.0-or-later",
"keywords": [
"WordPress",
"Theme"
],
"homepage": "https://github.com/WebDevStudios/wds-bt/#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/WebDevStudios/wds-bt.git"
},
"bugs": {
"url": "https://github.com/WebDevStudios/wds-bt/issues"
},
"engines": {
"node": ">=22.0.0",
"npm": ">=10"
},
"dependencies": {
"@wordpress/block-editor": "^14.21.0",
"@wordpress/blocks": "^14.15.0",
"@wordpress/components": "^29.12.0",
"@wordpress/compose": "^7.26.0",
"@wordpress/hooks": "^4.26.0",
"@wordpress/i18n": "^5.26.0",
"@wordpress/token-list": "^3.26.0",
"body-parser": "^2.2.0",
"braces": "^3.0.3",
"cookie": "^1.0.2",
"dotenv": "^17.2.0",
"express": "^5.1.0",
"got": "^14.4.7",
"npm": "^11.4.2",
"postcss": "^8.5.6",
"send": "^1.2.0",
"serve-static": "^2.2.0",
"svgo": "^4.0.0",
"uuid": "^11.1.0",
"ws": "^8.18.3",
"xml2js": "^0.6.2"
},
"devDependencies": {
"@babel/core": "^7.28.0",
"@babel/plugin-transform-class-static-block": "7.27.1",
"@babel/preset-env": "^7.28.0",
"@babel/preset-react": "^7.27.1",
"@evilmartians/lefthook": "^1.12.2",
"@typescript-eslint/eslint-plugin": "^8.37.0",
"@wordpress/dependency-extraction-webpack-plugin": "^6.26.0",
"@wordpress/env": "^10.26.0",
"@wordpress/eslint-plugin": "^22.12.0",
"@wordpress/prettier-config": "^4.26.0",
"@wordpress/scripts": "^30.19.0",
"autoprefixer": "^10.4.21",
"babel-loader": "^10.0.0",
"clean-webpack-plugin": "^4.0.0",
"compression-webpack-plugin": "^11.1.0",
"copy-webpack-plugin": "^13.0.0",
"cross-env": "^7.0.3",
"css-minimizer-webpack-plugin": "^7.0.2",
"dotenv-cli": "^8.0.0",
"eslint": "8.57.1",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-prettier": "^5.5.1",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-webpack-plugin": "^5.0.2",
"glob": "^11.0.3",
"html_codesniffer": "2.5.1",
"image-minimizer-webpack-plugin": "^4.1.3",
"imagemin": "^9.0.1",
"imagemin-gifsicle": "^7.0.0",
"imagemin-jpegtran": "^8.0.0",
"imagemin-mozjpeg": "^10.0.0",
"imagemin-optipng": "^8.0.0",
"imagemin-svgo": "^11.0.1",
"inquirer": "^12.7.0",
"lint-staged": "16.1.2",
"mini-css-extract-plugin": "^2.9.2",
"npm-check-updates": "^18.0.1",
"npm-run-all": "4.1.5",
"pa11y-ci": "^3.1.0",
"postcss-loader": "^8.1.1",
"postcss-move-props-to-bg-image-query": "^4.0.0",
"postcss-preset-env": "^10.2.4",
"postcss-rtl": "^2.0.0",
"prettier": "3.6.2",
"puppeteer-core": "24.14.0",
"remove-files-webpack-plugin": "^1.5.0",
"rimraf": "^6.0.1",
"sass-loader": "^16.0.5",
"stylelint-webpack-plugin": "^5.0.1",
"svg-spritemap-webpack-plugin": "^4.7.0",
"svg-transform-loader": "^2.0.13",
"terser-webpack-plugin": "^5.3.14",
"thread-loader": "^4.0.4",
"webpack": "^5.100.2",
"webpack-cli": "^6.0.1",
"webpackbar": "^7.0.0"
},
"scripts": {
"a11y": "node a11y.cjs",
"build": "rimraf blocks build && wp-scripts build --config webpack.config.js --progress && npm run fonts:generate",
"create-block": "run-s create-block:run",
"create-block:run": "cd ./assets/blocks && npx @wordpress/create-block --namespace=wdsbt --template ../../inc/block-template --no-plugin",
"format": "wp-scripts format && npm run format:php && npm run format:js",
"format:css": "wp-scripts format ./assets/**/*.scss",
"format:php": "composer run-script phpcs-fix",
"fonts": "rimraf build/fonts && php tools/font-processor.php",
"fonts:detect": "php tools/font-detection.php",
"fonts:generate": "php tools/generate-theme-json.php",
"lint": "run-p lint:*",
"lint:css": "wp-scripts lint-style",
"lint:js": "wp-scripts lint-js",
"lint:md:docs": "wp-scripts lint-md-docs",
"lint:php": "composer run-script phpcs",
"lint:pkg-json": "wp-scripts lint-pkg-json",
"packages-update": "npx npm-check-updates -u && npm install && npm dedupe && npm audit fix",
"postinstall": "npx lefthook install && git config --local core.hooksPath .git/hooks && ./scripts/update-cursorrules.sh",
"preinstall": "npx cross-env npm_config_legacy_peer_deps=true",
"reset": "rimraf node_modules vendor build blocks package-lock.json composer.lock",
"setup": "npm run reset && npm i && composer i && npm run build",
"start": "rimraf build blocks && npm run fonts && wp-scripts start",
"update-cursorrules": "./scripts/update-cursorrules.sh",
"version-update": "dotenv node updateVersion.js"
},
"lint-staged": {
"*.js": "wp-scripts lint-js",
"*.php": "composer run lint",
"*.scss": "wp-scripts lint-style",
"*.json": "wp-scripts lint-pkg-json",
"*.md": "wp-scripts lint-md-docs"
}
"name": "wds-bt",
"version": "1.3.5",
"private": true,
"description": "A starter block theme from WebDevStudios.",
"author": "WebDevStudios <contact@webdevstudios.com>",
"license": "GPL-2.0-or-later",
"keywords": [
"WordPress",
"Theme"
],
"homepage": "https://github.com/WebDevStudios/wds-bt/#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/WebDevStudios/wds-bt.git"
},
"bugs": {
"url": "https://github.com/WebDevStudios/wds-bt/issues"
},
"engines": {
"node": ">=22.0.0",
"npm": ">=10"
},
"dependencies": {
"@wordpress/block-editor": "^14.21.0",
"@wordpress/blocks": "^14.15.0",
"@wordpress/components": "^29.12.0",
"@wordpress/compose": "^7.26.0",
"@wordpress/hooks": "^4.26.0",
"@wordpress/i18n": "^5.26.0",
"@wordpress/token-list": "^3.26.0",
"body-parser": "^2.2.0",
"braces": "^3.0.3",
"cookie": "^1.0.2",
"dotenv": "^17.2.0",
"express": "^5.1.0",
"got": "^14.4.7",
"npm": "^11.4.2",
"postcss": "^8.5.6",
"send": "^1.2.0",
"serve-static": "^2.2.0",
"svgo": "^4.0.0",
"uuid": "^11.1.0",
"ws": "^8.18.3",
"xml2js": "^0.6.2"
},
"devDependencies": {
"@babel/core": "^7.28.0",
"@babel/plugin-transform-class-static-block": "7.27.1",
"@babel/preset-env": "^7.28.0",
"@babel/preset-react": "^7.27.1",
"@evilmartians/lefthook": "^1.12.2",
"@typescript-eslint/eslint-plugin": "^8.37.0",
"@wordpress/dependency-extraction-webpack-plugin": "^6.26.0",
"@wordpress/env": "^10.26.0",
"@wordpress/eslint-plugin": "^22.12.0",
"@wordpress/prettier-config": "^4.26.0",
"@wordpress/scripts": "^30.19.0",
"autoprefixer": "^10.4.21",
"babel-loader": "^10.0.0",
"clean-webpack-plugin": "^4.0.0",
"compression-webpack-plugin": "^11.1.0",
"copy-webpack-plugin": "^13.0.0",
"cross-env": "^7.0.3",
"css-minimizer-webpack-plugin": "^7.0.2",
"dotenv-cli": "^8.0.0",
"eslint": "8.57.1",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-prettier": "^5.5.1",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-webpack-plugin": "^5.0.2",
"glob": "^11.0.3",
"html_codesniffer": "2.5.1",
"image-minimizer-webpack-plugin": "^4.1.3",
"imagemin": "^9.0.1",
"imagemin-gifsicle": "^7.0.0",
"imagemin-jpegtran": "^8.0.0",
"imagemin-mozjpeg": "^10.0.0",
"imagemin-optipng": "^8.0.0",
"imagemin-svgo": "^11.0.1",
"inquirer": "^12.7.0",
"lint-staged": "16.1.2",
"mini-css-extract-plugin": "^2.9.2",
"npm-check-updates": "^18.0.1",
"npm-run-all": "4.1.5",
"pa11y-ci": "^3.1.0",
"postcss-loader": "^8.1.1",
"postcss-move-props-to-bg-image-query": "^4.0.0",
"postcss-preset-env": "^10.2.4",
"postcss-rtl": "^2.0.0",
"prettier": "3.6.2",
"puppeteer-core": "24.14.0",
"remove-files-webpack-plugin": "^1.5.0",
"rimraf": "^6.0.1",
"sass-loader": "^16.0.5",
"stylelint-webpack-plugin": "^5.0.1",
"svg-spritemap-webpack-plugin": "^4.7.0",
"svg-transform-loader": "^2.0.13",
"terser-webpack-plugin": "^5.3.14",
"thread-loader": "^4.0.4",
"webpack": "^5.100.2",
"webpack-cli": "^6.0.1",
"webpackbar": "^7.0.0"
},
"scripts": {
"a11y": "node a11y.cjs",
"build": "rimraf blocks build && wp-scripts build --config webpack.config.js --progress && npm run fonts:generate",
"create-block": "run-s create-block:run",
"create-block:run": "cd ./assets/blocks && npx @wordpress/create-block --namespace=wdsbt --template ../../inc/block-template --no-plugin",
"format": "wp-scripts format && npm run format:php && npm run format:js",
"format:css": "wp-scripts format ./assets/**/*.scss",
"format:php": "composer run-script phpcs-fix",
"fonts": "rimraf build/fonts && php tools/font-processor.php",
"fonts:detect": "php tools/font-detection.php",
"fonts:generate": "rimraf build/fonts && php tools/generate-theme-json.php",
"lint": "run-p lint:*",
"lint:css": "wp-scripts lint-style",
"lint:js": "wp-scripts lint-js",
"lint:md:docs": "wp-scripts lint-md-docs",
"lint:php": "composer run-script phpcs",
"lint:pkg-json": "wp-scripts lint-pkg-json",
"packages-update": "npx npm-check-updates -u && npm install && npm dedupe && npm audit fix",
"postinstall": "npx lefthook install && git config --local core.hooksPath .git/hooks && ./scripts/update-cursorrules.sh",
"preinstall": "npx cross-env npm_config_legacy_peer_deps=true",
"reset": "rimraf node_modules vendor build blocks package-lock.json composer.lock",
"setup": "npm run reset && npm i && composer i && npm run build",
"start": "rimraf build blocks && npm run fonts && wp-scripts start",
"update-cursorrules": "./scripts/update-cursorrules.sh",
"version-update": "dotenv node updateVersion.js"
},
"lint-staged": {
"*.js": "wp-scripts lint-js",
"*.php": "composer run lint",
"*.scss": "wp-scripts lint-style",
"*.json": "wp-scripts lint-pkg-json",
"*.md": "wp-scripts lint-md-docs"
}
}
Loading
Loading