You are here: Home Articles Make your website faster (resources optimization)

Make your website faster (resources optimization)

by Jean-Michel FRANCOIS last modified Nov 28, 2011 05:51 PM
this article show best practice with the CMS Plone on optimizing CSS and Javascripts . It will make your website faster to load on web browser and it will unload your webserver.

A page on a website is displayed in your browser using three technologies: HTML, CSS and Javascript. The HTML is responsible for the structure (sementic) and also to load resources. CSS and Javascripts are resources.

There are best practices around this and well described on the article: Web performance best practices by Google.

To follow these rules, the CMS Plone has great tools: the CSS resource registry aka portal_css and the Javascripts resource registry aka portal_javascripts.

This tool let you register a resource and manage options like the way you want to include it in the page (link, import, ...), if it can be merge with others, if it can be compressed, etc ...

In this article I want to show you a step often forgot: re-organize and adjust those configurations to have fewer http requests.

To manage this you just have to check order and understand how plone is merging resources, and how they should be merged. IMO you must first include libraries (960.css or jquery) and all resources for anonymous. Next you have to check the way they are included, it must be the same or the CMS will not be able to merge them. This apply also to cache option. To summarize this:

  • same way to import the resource (link)
  • merge option to true for all resources
  • cacheable option should be the same for resources
  • Check the order twice (libraries like jquery should be at the top)
  •  

    Put at the bottom all specfic resources (authenticated resources like member.css, or tinymce.js) and you will have an optimized configuration with only one css request for an anonymous visitor.

    You just have to check the tab: "Merged composition" under ZMI to know how the CMS will merge your resources.

    The result for CSS and JS configuration of a production website:

    Merged CSS in Plone

     

    Merged JS in Plone

    Share |
    Filed under:
    comments powered by Disqus