Book Image

Liferay 6.x Portal Enterprise Intranets Cookbook

Book Image

Liferay 6.x Portal Enterprise Intranets Cookbook

Overview of this book

Table of Contents (19 chapters)
Liferay 6.x Portal Enterprise Intranets Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Enabling JS and CSS minification


When your web page loads in a browser, the browser sends an HTTP request to the web server for the page in the URL. Then, as the HTML is delivered, the browser parses it and looks for additional requests for images, scripts, CSS, and so on. Every time it sees a request for a new element, it sends another HTTP request to the server. In order to decrease the number of additional requests, Liferay has the following ready-to-use mechanisms:

  • Minifier (compressor) that allows you to compress and minify your JavaScript and CSS files

  • Merging JavaScript files to reduce the number of HTTP requests using barebone.jsp and everything.jsp

  • Merging CSS files and images for faster loading

  • Enabling Gzip compression

How to do it…

To set Liferay's fast-load mechanisms, set the following properties in the portal-ext.properties file:

minifier.enabled=true
javascript.fast.load=true
theme.css.fast.load=true
theme.images.fast.load=true
layout.template.cache.enabled=true

Additionally, if...