Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now its even #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-/*
|--------------------------------------------------------------------------
Expand All @@ -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**

12 changes: 9 additions & 3 deletions application/hooks/Minifyhtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand All @@ -43,4 +49,4 @@ function output()
$CI->output->_display();
}
}
?>
?>