Added comments to WordPress/PHP built output.

This commit is contained in:
2022-08-18 12:23:30 +03:00
parent 3aa5370c2b
commit 7b7a8c101f
+11 -2
View File
@@ -35,7 +35,7 @@ trait Custom_Handlebars {
return $context;
} );
$this->add_handlebar( 'wp_kses_post', function ( $context ) {
$this->add_handlebar( 'safe_html', function ( $context ) {
if ( function_exists( 'wp_kses_post' ) ) {
return wp_kses_post( $context );
}
@@ -91,7 +91,16 @@ class Component_Builder {
$file_path_parts[] = 'php';
$file_path = join( '.', $file_path_parts );
$t = file_put_contents( $file_path, '<?php ' . $content . ' ?>' );
$comment = "
/**
* FILE INFO:
* This file was generated by LightCandy::compile function.
* The original source is the .HBS(handlebars) file that is located next to this generated PHP file.
*/
";
$t = file_put_contents( $file_path, '<?php ' . $comment . $content . ' ?>' );
if ( $t === false ) {
die( "Error: Can't generate HBS template to PHP file. Cache folder is not accessible." );
}