|
|
|
@ -3,7 +3,6 @@ |
|
|
|
// Composer - Autoloader |
|
|
|
require_once __DIR__ . '/vendor/autoload.php'; |
|
|
|
|
|
|
|
use JetBrains\PhpStorm\NoReturn; |
|
|
|
use LightnCandy\Flags; |
|
|
|
use LightnCandy\LightnCandy; |
|
|
|
|
|
|
|
@ -61,9 +60,23 @@ class Component_Builder { |
|
|
|
$this->register_default_handlebar_helpers(); |
|
|
|
} |
|
|
|
|
|
|
|
#[NoReturn] |
|
|
|
function build() { |
|
|
|
$file_name = $this->get_handlebars_template( __DIR__ . '/' . $this->module_path . '/../../src/' . $this->component_name . '.template.hbs' ); |
|
|
|
function build(): void { |
|
|
|
$root_path = __DIR__ . '/' . $this->module_path . '../..'; |
|
|
|
$file_name = $this->get_handlebars_template( "$root_path/src/$this->component_name.template.hbs" ); |
|
|
|
|
|
|
|
$output_folder = $root_path . '/exports/wordpress/templates'; |
|
|
|
foreach ( [ 'styles', 'scripts', 'images' ] as $dir ) { |
|
|
|
$output_dir = "$output_folder/$dir"; |
|
|
|
if ( is_dir( $output_dir ) === false ) { |
|
|
|
mkdir( $output_dir, 0777, true ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
rename( $file_name, "$output_folder/$this->component_name.template.php" ); |
|
|
|
copy( "$root_path/src/styles/$this->component_name.min.css", "$output_folder/styles/$this->component_name.min.css" ); |
|
|
|
copy( "$root_path/src/scripts/$this->component_name.min.js", "$output_folder/scripts/$this->component_name.min.js" ); |
|
|
|
shell_exec( "cp -r $root_path/src/images $output_folder" ); |
|
|
|
|
|
|
|
echo "Generated '$file_name'."; |
|
|
|
} |
|
|
|
|
|
|
|
|