From 3408b2e2838348eba8b069b75ae8338b7f240374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20D=C4=9Bdi=C4=8D?= Date: Fri, 24 May 2024 14:28:56 +0200 Subject: [PATCH] Fixed an error with MIME type caused by WP not recognizing .cjs files --- gulpfile.js | 20 +++++++++++++------- src/php/frontend/class-shortcode.php | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 75a968250..6654170bb 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -99,13 +99,19 @@ gulp.task( gulp.series('build:deps:composer:scoper', 'build:deps:composer:autoloader') ); -gulp.task('build:deps:npm:imagelightbox', () => - gulp - .src([ - 'node_modules/imagelightbox/dist/imagelightbox.css', - 'node_modules/imagelightbox/dist/imagelightbox.umd.cjs', - ]) - .pipe(gulp.dest('dist/bundled/')) +gulp.task( + 'build:deps:npm:imagelightbox', + gulp.parallel( + () => + gulp + .src(['node_modules/imagelightbox/dist/imagelightbox.css']) + .pipe(gulp.dest('dist/bundled/')), + () => + gulp + .src(['node_modules/imagelightbox/dist/imagelightbox.umd.cjs']) + .pipe(rename('imagelightbox.umd.js')) + .pipe(gulp.dest('dist/bundled/')) + ) ); gulp.task('build:deps:npm:imagesloaded', () => diff --git a/src/php/frontend/class-shortcode.php b/src/php/frontend/class-shortcode.php index 8f3c187ea..46729b110 100644 --- a/src/php/frontend/class-shortcode.php +++ b/src/php/frontend/class-shortcode.php @@ -50,7 +50,7 @@ public static function init() { Script_And_Style_Helpers::register_script( 'sgdg_imagelightbox_script', - 'bundled/imagelightbox.umd.cjs', + 'bundled/imagelightbox.umd.js', array( 'jquery' ) ); Script_And_Style_Helpers::register_style( 'sgdg_imagelightbox_style', 'bundled/imagelightbox.css' );