From 5f08677ac5b41d28b27e3f673aa161ad63670854 Mon Sep 17 00:00:00 2001 From: Fahad Kassim Date: Mon, 2 Jan 2017 18:01:10 +0300 Subject: [PATCH 1/2] Now its even --- application/hooks/Minifyhtml.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 +?> From beaafbc299cc3a5cf91d96bc3aaf7aee70ec063e Mon Sep 17 00:00:00 2001 From: Fahad Kassim Date: Mon, 2 Jan 2017 18:05:32 +0300 Subject: [PATCH 2/2] Update README.md --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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**