Book Image

CakePHP 2 Application Cookbook

By : James Watts, Cake Software Foundation, Inc.
Book Image

CakePHP 2 Application Cookbook

By: James Watts, Cake Software Foundation, Inc.

Overview of this book

Table of Contents (20 chapters)
CakePHP 2 Application Cookbook
About the Authors
About the Reviewer

The AssetCompress plugin

The handling of static assets, such as scripts and stylesheets, is an important aspect of applications that are expected to perform and deliver content quickly.

In this recipe, we'll look at how to include and set up the AssetCompress plugin to make sure we're serving content quickly and efficiently, without putting a burden on the server when the users are coming.

Getting ready

The AssetCompress plugin can be found at

The content of this plugin needs to be added in app/Plugin/AssetCompress/ and then loaded in your application. To do so, add the following code in your bootstrap.php file located in app/Config/:

CakePlugin::load('AssetCompress', array('bootstrap' => true));

This should be added before the section of the file that calls the following:

Configure::write('Dispatcher.filters', array(

Now, create an app.js file in app/webroot/js/, and create an app.css file in app/webroot...