Browse Source

Added comments to WordPress/PHP built output.

pull/1/head
Roman Axelrod 3 years ago
parent
commit
7b7a8c101f
  1. 13
      platforms/php/build.php

13
platforms/php/build.php

@ -35,7 +35,7 @@ trait Custom_Handlebars {
return $context; return $context;
} ); } );
$this->add_handlebar( 'wp_kses_post', function ( $context ) { $this->add_handlebar( 'safe_html', function ( $context ) {
if ( function_exists( 'wp_kses_post' ) ) { if ( function_exists( 'wp_kses_post' ) ) {
return wp_kses_post( $context ); return wp_kses_post( $context );
} }
@ -91,7 +91,16 @@ class Component_Builder {
$file_path_parts[] = 'php'; $file_path_parts[] = 'php';
$file_path = join( '.', $file_path_parts ); $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 ) { if ( $t === false ) {
die( "Error: Can't generate HBS template to PHP file. Cache folder is not accessible." ); die( "Error: Can't generate HBS template to PHP file. Cache folder is not accessible." );
} }

Loading…
Cancel
Save