manobi / minify-cakephp

MInify plugin for CakePHP 2.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Minify plugin for CakePHP

Copyright 2012, Maury M. Marques Licensed under The MIT License Redistributions of files must retain the above copyright notice.

Minify

Minify is an application that combines multiple CSS or Javascript files, removes unnecessary whitespace and comments, and serves them with gzip encoding and optimal client-side cache headers.

More info: http://code.google.com/p/minify

For this plugin, the application Minify is inside Vendor

Version

Written for CakePHP 2.0+

Installation

You can clone the plugin into your project (or if you want you can use as a submodule):

cd path/to/app/Plugin or /plugins
git clone https://github.com/maurymmarques/minify-cakephp.git Minify

Bootstrap the plugin in app/Config/bootstrap.php:

<?php
CakePlugin::load(array('Minify' => array('routes' => true)));

Configuration

Set the configuration file in your app/Config/core.php

<?php
Configure::write('MinifyAsset', true);

If you do not want to use compression, set false.

Note

Create a folder called "minify" in app/tmp/cache and give permission to read and write.

Usage

Enable the helper using the plugin syntax

<?php
class BakeriesController extends AppController {
    public $helpers = array('Minify.Minify');
}

This plugin uses HtmlHelper, and works virtually the same.

In the view you can use something like:

<?php
echo $this->Minify->css(array('default', 'global'));
echo $this->Minify->script(array('jquery', 'interface'));

About

MInify plugin for CakePHP 2.0


Languages

Language:PHP 92.4%Language:Java 3.9%Language:JavaScript 3.7%