Pluggable JS processing

Last updated on
6 October 2020

What is being done in Drupal 7

Current Drupal JS Workflow (2).png

Assetic

What is Assetic?

Assetic is an asset management framework for PHP. It loads, processes with filters and dumps asset files as JS and CSS files. More info can be found at https://github.com/kriswallsmith/assetic/ and a presentation is available at http://symfony.com/video/Paris2011/571

Advantages of getting Assetic into Drupal

Assetic comes with a number of filters that allow to process files to convert them to CSS or JS and to compress and optimize them, here the most interesting:

Filter Requires Related module What it does
Google closure compiler Web API or JAR Closure compiler JS optimisation
Sass sass binary Sass convert Sass to CSS
YUI compressor YUI jar N/A compress JS and CSS
CSSEmbed jar CSS Embedded image embed images in CSS
Compass compass binary Compass load compass files
Lessphp lessphp library Less convert LESS files to CSS

(full list available on the project page)

  • It is entirely pluggable and new filters can be added
  • The order, the collections and the way they are processed can be re-arranged
  • A UI to manage the above can be built

How to get Assetic into Drupal

  • Modify Drupal API (remove drupal_add_js/css, rewrite drupal_add_library)

Drupal with AMD and Assetic - The Assetic picture.png

Help improve this page

Page status: No known problems

You can: