@@ -411,81 +411,6 @@ ${ blockDesignSystem });
411411 cb ( )
412412} )
413413
414- gulp . task ( 'generate-design-library-default-placeholders-php' , function ( cb ) {
415- const fs = require ( 'fs' )
416-
417- let defaultPlaceholders = 'array()'
418-
419- const toAssocArray = ( key , value , cb , indent ) => {
420- if ( typeof value === 'object' ) {
421- const parsed = cb ( value , indent + 1 )
422- return `"${ key } " => ${ parsed } `
423- }
424-
425- return `"${ key } " => "${ value } "`
426- }
427-
428- const parsePlaceholders = ( obj , indent ) => {
429- let content = ''
430- const tab = '\t' . repeat ( indent )
431-
432- if ( typeof obj === 'object' ) {
433- content += 'array(\n'
434-
435- Object . entries ( obj ) . forEach ( ( [ key , value ] , index , bds ) => {
436- content += tab + toAssocArray ( key , value , parsePlaceholders , indent )
437-
438- if ( index !== bds . length - 1 ) {
439- content += ',\n'
440- } else {
441- content += '\n'
442- }
443- } )
444- content += `\t` . repeat ( indent - 1 ) + ')'
445- }
446- return content
447- }
448-
449- const jsonPath = path . resolve ( __dirname , `src/components/design-library-list/default.json` )
450- if ( fs . existsSync ( jsonPath ) ) {
451- const fileContent = fs . readFileSync ( jsonPath , 'utf-8' )
452- const raw = JSON . parse ( fileContent )
453- defaultPlaceholders = parsePlaceholders ( raw , 4 )
454- }
455-
456- // Generate PHP variable string
457- const script = `<?php
458- // This is a generated file by gulp generate-design-library-default-placeholders-php
459- // Use src/components/design-library-list/default.json if you want to edit this file.
460-
461- // Exit if accessed directly.
462- if ( ! defined( 'ABSPATH' ) ) {
463- exit;
464- }
465-
466- if ( ! class_exists( 'Stackable_Design_Library_Placeholders' ) ) {
467- class Stackable_Design_Library_Placeholders {
468-
469- function __construct() {
470- }
471-
472- public static function get_default() {
473- $default_placeholders = ${ defaultPlaceholders } ;
474-
475- return $default_placeholders;
476- }
477- }
478-
479- new Stackable_Design_Library_Placeholders();
480- }
481- ?>
482- `
483- // Write PHP variable to file
484- fs . writeFileSync ( path . resolve ( __dirname , 'src/design-library/default-placeholders.php' ) , script )
485-
486- cb ( )
487- } )
488-
489414gulp . task ( 'generate-translations-js' , gulp . series (
490415 // The collect function has an issue where it will not continue if the
491416 // folder will it writes to doesn't exist, create it to prevent an error.
@@ -778,7 +703,7 @@ gulp.task( 'style-deprecated', gulp.parallel(
778703 * END deprecated build styles, we still build these
779704 ********************************************************************/
780705
781- gulp . task ( 'build-process' , gulp . parallel ( 'style' , 'style-editor' , 'welcome-styles' , 'style-deprecated' , 'generate-translations-js' , 'generate-stk-block-typesphp' , 'generate-design-library-default-placeholders-php' ) )
706+ gulp . task ( 'build-process' , gulp . parallel ( 'style' , 'style-editor' , 'welcome-styles' , 'style-deprecated' , 'generate-translations-js' , 'generate-stk-block-typesphp' ) )
782707
783708gulp . task ( 'build-block-design-system' , gulp . parallel ( 'generate-block-design-system-php' , 'generate-block-design-system-scss' ) )
784709
@@ -815,11 +740,6 @@ const watchFuncs = ( basePath = '.' ) => {
815740 [ `${ basePath } /src/block/**/block.json` ] ,
816741 gulp . parallel ( [ 'generate-stk-block-typesphp' ] )
817742 )
818-
819- gulp . watch (
820- [ `${ basePath } /src/components/design-library-list/default.json` ] ,
821- gulp . parallel ( [ 'generate-design-library-default-placeholders-php' ] )
822- )
823743}
824744
825745gulp . task ( 'watch' , gulp . series ( 'build-block-design-system' , 'build-process' , function watch ( done ) {
0 commit comments