Skip to content

Instantly share code, notes, and snippets.

@raamdev
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save raamdev/1d88d0b5a37d0a461577 to your computer and use it in GitHub Desktop.

Select an option

Save raamdev/1d88d0b5a37d0a461577 to your computer and use it in GitHub Desktop.

Revisions

  1. JasWSInc revised this gist Dec 3, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion htmlc-test.php
    Original file line number Diff line number Diff line change
    @@ -38,4 +38,5 @@
    'vendor_css_prefixes' => array('moz', 'webkit', 'khtml', 'ms', 'o')
    );
    $html_compressor = new \websharks\html_compressor\core($html_compressor_options);
    $compressed_html = $html_compressor->compress(file_get_contents($url));
    $compressed_html = $html_compressor->compress(file_get_contents($url));
    echo $compressed_html;
  2. JasWSInc revised this gist Dec 3, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion htmlc-test.php
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@

    /* --- Config. section. ----------------------------------------------------------------------- */

    $url = 'http://wallshit.com/'; // Swap this out when testing.
    $url = 'http://yoursite.com/'; // Swap this out when testing.

    // Install the HTML Compressor locally, and change the following path as necessary.
    require_once $_SERVER['WEBSHARK_HOME'].'/websharks/html-compressor/html-compressor/stub.php';
  3. JasWSInc created this gist Dec 3, 2014.
    41 changes: 41 additions & 0 deletions htmlc-test.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    <?php
    error_reporting(-1);
    ini_set('display_errors', TRUE);

    /* --- Config. section. ----------------------------------------------------------------------- */

    $url = 'http://wallshit.com/'; // Swap this out when testing.

    // Install the HTML Compressor locally, and change the following path as necessary.
    require_once $_SERVER['WEBSHARK_HOME'].'/websharks/html-compressor/html-compressor/stub.php';

    /* -------------------------------------------------------------------------------------------- */

    $html_compressor_options = array(

    'css_exclusions' => array(),
    'js_exclusions' => array('.php?'),

    'cache_expiration_time' => '14 days',
    'cache_dir_public' => sys_get_temp_dir(),
    'cache_dir_private' => sys_get_temp_dir(),
    'cache_dir_url_public' => 'http://example.com/htmlc/cache/public',

    'current_url_scheme' => 'http',
    'current_url_host' => parse_url($url, PHP_URL_HOST),
    'current_url_uri' => parse_url($url, PHP_URL_PATH),

    'compress_combine_head_body_css' => TRUE,
    'compress_combine_head_js' => TRUE,
    'compress_combine_footer_js' => TRUE,
    'compress_inline_js_code' => TRUE,
    'compress_css_code' => TRUE,
    'compress_js_code' => TRUE,
    'compress_html_code' => FALSE,

    'benchmark' => FALSE,
    'product_title' => 'HTML Compressor',
    'vendor_css_prefixes' => array('moz', 'webkit', 'khtml', 'ms', 'o')
    );
    $html_compressor = new \websharks\html_compressor\core($html_compressor_options);
    $compressed_html = $html_compressor->compress(file_get_contents($url));