Minify Html in Cakephp 2.x
Hello friends welcome to findnerd. Today I am going to tell you how to minify html in cakephp 2. I am going to use minify html plugin which will remove unnecessary white spaces from html. This plugin is also available on github and you can download it easily and use it. Basic requirements for installing this plugin:
- PHP 5.2 or above
- Cakephp 2.x
Let's start installing this plugin, follow the steps given below:
Step 1: Download Minify Plugin
Step 2: Create Plugin
- Extract the zip archive when the downloading is completed.
- Rename folder "cakephp-minifyhtml-plugin-master" to "MinifyHtml".
- Copy "MinifyHtml" folder to
cakephp2_project/app/Plugin/
Step 3: Load Plugin
- Edit
bootstrap.php
and write the following code. This will load the plugin "MinifyHtml"
CakePlugin::load('MinifyHtml');
- Go to
app/Controller/AppController.php
and add the following line:
public $helpers = array("MinifyHtml.MinifyHtml");
Now load the project on the browser and by pressing Ctrl + U
you can see that plugin has minified all the html pages of the project.
Thanks for reading the blog.
0 Comment(s)