Created
April 12, 2019 04:36
-
-
Save krugazul/d616acb91e38823cd4b60732b40c730d to your computer and use it in GitHub Desktop.
Terminal Commands - Generate Lighthouse Reports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Terminal Commands | |
* | |
* Template Name: Terminal Commands | |
* | |
* @package lsx | |
* @subpackage template | |
*/ | |
get_header(); ?> | |
<?php lsx_content_wrap_before(); ?> | |
<div id="primary" class="content-area col-sm-12"> | |
<?php lsx_content_before(); ?> | |
<main id="main" class="site-main" role="main"> | |
<?php lsx_content_top(); ?> | |
<ul class="nav nav-tabs nav-pills"> | |
<li class="active"><a data-toggle="tab" href="#desktop"><?php esc_attr_e( 'Desktop', 'lsx' ); ?></a></li> | |
<li><a data-toggle="tab" href="#mobile"><?php esc_attr_e( 'Mobile', 'lsx' ); ?></a></li> | |
<li><a data-toggle="tab" href="#performance-desktop"><?php esc_attr_e( 'Desktop Performance Only', 'lsx' ); ?></a></li> | |
<li><a data-toggle="tab" href="#performance-mobile"><?php esc_attr_e( 'Mobile Performance Only', 'lsx' ); ?></a></li> | |
</ul> | |
<?php | |
$base_site = '/'; | |
$path = '/Users/krugazul/Documents/Lighthouse\ Reports/'; | |
$urls = array( | |
'/', | |
'/traveller-info/', | |
'/traveller-info/getting-around/', | |
'/traveller-info/itineraries-and-tours/', | |
'/traveller-info/maps-guides/', | |
'/traveller-info/getting-to-cape-town/', | |
'/contact/', | |
'/contact/thank-you/', | |
'/things-to-do/', | |
'/eat-and-drink/', | |
'/stay/', | |
'/terms-conditions/', | |
'/?s=cape', | |
'/?s=ashgf', | |
'/events/', | |
'/event/kirstenbosch-summer-concerts/', | |
'/events/community/add', | |
'/events/community/add', | |
'/events/community/list', | |
'/member-directory/', | |
'/member/virginias-member/', | |
'/member-tier/classic/', | |
'/blog/', | |
'/hotels-in-cape-town/', | |
'/category/blog/', | |
'/type/accommodation/', | |
'/city-area/beyond-the-city/', | |
'/404/', | |
'/sitemap/', | |
); | |
?> | |
<div class="tab-content" style=" | |
padding: 2rem 2rem 0 2rem; | |
border-left: 1px solid #ddd; | |
border-bottom: 1px solid #ddd; | |
border-right: 1px solid #ddd; | |
background-color: white; | |
"> | |
<div id="desktop" class="tab-pane fade in active"> | |
<?php | |
$counter = 1; | |
$config_path = '/Users/krugazul/Documents/Lighthouse\ Configs/lr-desktop-config.js'; | |
$tab_id = 'desktop'; | |
foreach ( $urls as $url ) { | |
if ( $base_site != $url ) { | |
$url_filename = str_replace( $base_site, '', $url ); | |
$url_filename = untrailingslashit( $url_filename ); | |
$url_filename = str_replace( '/', '.', $url_filename ); | |
} else { | |
$url_filename = 'home'; | |
} | |
//print_r('<div><span>' . $counter . '</span>'); | |
print_r('<pre style="overflow-x: auto;white-space: pre-wrap;white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap;word-wrap: break-word;" >'); | |
print_r( 'lighthouse ' . $url . ' --output json --output html --output-path ' . $path . $url_filename . '.' . $tab_id . ' --config-path=' . $config_path ); | |
print_r('</pre>'); | |
//print_r('</div>'); | |
$counter++; | |
} | |
?> | |
</div> | |
<div id="mobile" class="tab-pane"> | |
<?php | |
$counter = 1; | |
$config_path = '/Users/krugazul/Documents/Lighthouse\ Configs/lr-mobile-config.js'; | |
$tab_id = 'mobile'; | |
foreach ( $urls as $url ) { | |
if ( $base_site != $url ) { | |
$url_filename = str_replace( $base_site, '', $url ); | |
$url_filename = untrailingslashit( $url_filename ); | |
$url_filename = str_replace( '/', '.', $url_filename ); | |
} else { | |
$url_filename = 'home'; | |
} | |
//print_r('<div><span>' . $counter . '</span>'); | |
print_r('<pre style="overflow-x: auto;white-space: pre-wrap;white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap;word-wrap: break-word;" >'); | |
print_r( 'lighthouse ' . $url . ' --output json --output html --output-path ' . $path . $url_filename . '.' . $tab_id . ' --config-path=' . $config_path ); | |
print_r('</pre>'); | |
//print_r('</div>'); | |
$counter++; | |
} | |
?> | |
</div> | |
<div id="performance-desktop" class="tab-pane"> | |
<?php | |
$counter = 1; | |
$config_path = '/Users/krugazul/Documents/Lighthouse\ Configs/perf-config-desktop.js'; | |
$tab_id = 'performance-desktop'; | |
foreach ( $urls as $url ) { | |
if ( $base_site != $url ) { | |
$url_filename = str_replace( $base_site, '', $url ); | |
$url_filename = untrailingslashit( $url_filename ); | |
$url_filename = str_replace( '/', '.', $url_filename ); | |
} else { | |
$url_filename = 'home'; | |
} | |
//print_r('<div><span>' . $counter . '</span>'); | |
print_r('<pre style="overflow-x: auto;white-space: pre-wrap;white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap;word-wrap: break-word;" >'); | |
print_r( 'lighthouse ' . $url . ' --output json --output html --output-path ' . $path . $url_filename . '.' . $tab_id . ' --config-path=' . $config_path ); | |
print_r('</pre>'); | |
//print_r('</div>'); | |
$counter++; | |
} | |
?> | |
</div> | |
<div id="performance-mobile" class="tab-pane"> | |
<?php | |
$counter = 1; | |
$config_path = '/Users/krugazul/Documents/Lighthouse\ Configs/perf-config-mobile.js'; | |
$tab_id = 'performance-mobile'; | |
foreach ( $urls as $url ) { | |
if ( $base_site != $url ) { | |
$url_filename = str_replace( $base_site, '', $url ); | |
$url_filename = untrailingslashit( $url_filename ); | |
$url_filename = str_replace( '/', '.', $url_filename ); | |
} else { | |
$url_filename = 'home'; | |
} | |
//print_r('<div><span>' . $counter . '</span>'); | |
print_r('<pre style="overflow-x: auto;white-space: pre-wrap;white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap;word-wrap: break-word;" >'); | |
print_r( 'lighthouse ' . $url . ' --output json --output html --output-path ' . $path . $url_filename . '.' . $tab_id . ' --config-path=' . $config_path ); | |
print_r('</pre>'); | |
//print_r('</div>'); | |
$counter++; | |
} | |
?> | |
</div> | |
</div> | |
</main><!-- #main --> | |
<?php lsx_content_after(); ?> | |
</div><!-- #primary --> | |
<?php lsx_content_wrap_after(); ?> | |
<?php get_footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment