Author:
firegoby
Version:
1.4
Released:
27 November 2012
Category:
Workflow

Browse

Description

Asset Compiler

Symphony CMS extension to concatenate & minify Javascript & CSS assets and update Symphony's output with the newly compiled, SHA1-tagged, filename.

  • Version: 1.4
  • Date: 5th February 2013
  • Requirements: Symphony 2.3
  • Author: Chris Batchelor

Synopsis

Asset Compiler scans an XSLT Template (master.xsl by default) for CSS and Javascript assets with an attribute of data-compile='true'. These assets are concatenated (in-order) into a single, minified file and tagged with a unique hash (to ensure fresh caching). Symphony's HTML output is updated, removing any data-compile='true' assets and replacing them with the single, minified file (just before closing </head> for CSS and just before closing </body> for Javascripts).

There are also a checkbox On/Off switches to control whether to serve the compiled assets. Javascript compilation is via an CURL API call to Google's Closure Compiler.

Installation

  1. Extract files into extension/asset-compiler directory

  2. Enable extension in System > Extensions

  3. Add a data-compile='true' attribute to any <link> or <script> element in master.xsl you wish to be compiled. All other stylesheets and javascripts in the template are ignored.

  4. In System > Preferences click Compile All Assets

  5. Tick one or both of Serve Compiled Javascript/Stylesheet Assets and click Save Changes

Note: the assets can be in any folder under the Symphony root, absolute paths for the domain (e.g. /workspace/styles) are trimmed of their leading / and appended to Symphony root prior to concatenation.

Updating Multiple Manifests

Asset Compiler stores the latest compiled filenames in manifest/config.php. If you use Rowan Lewis' "Dual Manifest Folders" setup you can check the Advanced: Save compilation details to ALL manifest.*/config.php files checkbox to ensure all your manifests are updated at the same time.

Frequently Asked Questions

How do I alter the compression/minification level for Google Closure Compiler (Javascript)?

Alter the closure_compression config entry in manifest/config.php. It must be one of the following 3 options: WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS or ADVANCED_OPTIMIZATIONS. By default it is set to WHITESPACE_ONLY to ensure maximum compatibility.

How do I change which XSLT Template is read? Default: master.xsl

Alter the xslt_template config entry in manifest/config.php, it should be relative to Symphony's root directory

How do I change the stylesheet output directory? Default: styles

Alter the styles_path config entry in manifest/config.php, it should be relative to Symphony's root directory

How do I change the javascripts output directory? Default: scripts

Alter the scripts_path config entry in manifest/config.php, it should be relative to Symphony's root directory

Repository

http://github.com/firegoby/asset_compiler

Discuss this Extension

Screenshot

asset-compiler-1360326124.png

Compatibility

2.7.10 Unsure
2.7.9 Unsure
2.7.8 Unsure
2.7.7 Unsure
2.7.6 Unsure
2.7.5 Unsure
2.7.4 Unsure
2.7.3 Unsure
2.7.2 Unsure
2.7.1 Unsure
2.7.0 Unsure
2.6.11 Unsure
2.6.10 Unsure
2.6.9 Unsure
2.6.8 Unsure
2.6.7 Unsure
2.6.6 Unsure
2.6.5 Unsure
2.6.4 Unsure
2.5.4 Unsure

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details