UPDATE Update audio player block to use local Plyr assets and add build scripts for asset management
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Antoine M 2025-10-29 17:20:39 +01:00
parent 47ff454ff0
commit d62e3ca3b9
5 changed files with 11 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -19,13 +19,14 @@ if (! defined('ABSPATH')) {
} }
/** /**
* Register Plyr library assets * Register Plyr library assets
* Assets are copied from node_modules to assets/plyr for production deployment
*/ */
function create_block_audio_player_register_plyr() function create_block_audio_player_register_plyr()
{ {
// Register Plyr CSS // Register Plyr CSS
wp_register_style( wp_register_style(
'plyr', 'plyr',
plugins_url('node_modules/plyr/dist/plyr.css', __FILE__), plugins_url('assets/plyr/plyr.css', __FILE__),
array(), array(),
'3.8.3' '3.8.3'
); );
@ -33,7 +34,7 @@ function create_block_audio_player_register_plyr()
// Register Plyr JS // Register Plyr JS
wp_register_script( wp_register_script(
'plyr', 'plyr',
plugins_url('node_modules/plyr/dist/plyr.min.js', __FILE__), plugins_url('assets/plyr/plyr.min.js', __FILE__),
array(), array(),
'3.8.3', '3.8.3',
true true

View File

@ -6,6 +6,9 @@
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
"main": "build/index.js", "main": "build/index.js",
"scripts": { "scripts": {
"copy-plyr": "mkdir -p assets/plyr && cp node_modules/plyr/dist/plyr.min.js assets/plyr/ && cp node_modules/plyr/dist/plyr.css assets/plyr/ && cp node_modules/plyr/dist/plyr.svg assets/plyr/",
"prebuild": "pnpm run copy-plyr",
"prestart": "pnpm run copy-plyr",
"build": "wp-scripts build --blocks-manifest", "build": "wp-scripts build --blocks-manifest",
"format": "wp-scripts format", "format": "wp-scripts format",
"lint:css": "wp-scripts lint-style", "lint:css": "wp-scripts lint-style",