diff --git a/README.md b/README.md index 24be873..d2fafca 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,11 @@ A CodeIgniter Hooks that will Minify the HTML, Reducing network latency, enhanci Installation ----------------- -Copy `/application/config/hooks.php` and `/application/hooks/Minifyhtml.php` into your `application` folder Project +Copy `/application/config/hooks.php` and +`/application/hooks/Minifyhtml.php` +into your `application` folder Project -Modify your `/applicatoin/config/config.php` into this: +Modify your `/application/config/config.php` into this: ```php -/* |-------------------------------------------------------------------------- @@ -25,5 +27,11 @@ Modify your `/applicatoin/config/config.php` into this: and your Done! ------------------------------------------------------ -Everytime you call `$this->load->view('view/view_file');`, output function in Minifyhtml Class will be used. +Everytime you call `$this->load->view('view/view_file');`, +output function in Minifyhtml Class will be used. + +Change Log +========== +**2nd January 2017** +Added an ability to skip **style** and **script tags** diff --git a/application/hooks/Minifyhtml.php b/application/hooks/Minifyhtml.php index e045c95..d9f7e10 100644 --- a/application/hooks/Minifyhtml.php +++ b/application/hooks/Minifyhtml.php @@ -7,6 +7,10 @@ * @category Output * @author John Gerome * @link https://github.com/johngerome/CodeIgniter-Minifyhtml-hooks + * + * Edited by + * @author Fahad Kassim + * @link https://github.com/fadsel/CodeIgniter-Minifyhtml-hooks */ class Minifyhtml { @@ -28,12 +32,14 @@ function output() (?: # Zero or more of... [^<]++ # Either one or more non-"<" | < # or a < starting a non-blacklist tag. - (?!/?(?:textarea|pre)\b) + # Skip Script and Style Tags + (?!/?(?:textarea|pre|script|style)\b) )*+ # (This could be "unroll-the-loop"ified.) ) # End (unnecessary) group. (?: # Begin alternation group. < # Either a blacklist start tag. - (?>textarea|pre)\b + # Dont foget the closing tags + (?>textarea|pre|script|style)\b | \z # or end of file. ) # End alternation group. ) # If we made it here, we are not in a blacklist tag. @@ -43,4 +49,4 @@ function output() $CI->output->_display(); } } -?> \ No newline at end of file +?>