Minifying [optimization]

Files transferred over the wire should be optimized as much as possible.


First files get compressed with GZip. That step is pretty straight forward and can be used to compressed all files: HTML, CSS, JavaScript, etc.

However, one way to make file even smaller is to start with smaller in the first place. This means having support for minifying files before sending them over the wire.

Implementation: Partial. Compressed CSS is properly handled.

Minifying: HTML

The Qt DOM implementation let you output your DOM in various formats. By default, you generally get a beautified version of your document with nice indentation and many newlines. However, that generates all sorts of problems because the DOM adds unwanted blanks (spaces, newline, tabs, etc.) that have side effects on our code. To prevent that, we completely avoid using the indentation feature. In effect, we already print out minified HTML and do not need to worry about that extra minification.

Implementation: Complete.

Minifying: CSS

The CSS files you add to the database get optimized using the csspp library. This library comes with a command line tool as well, although in our case a plugin takes care of the minification so we do not bother with the tool.

The minification step also includes a verification of the CSS data meaning that before the CSS gets used you can make sure browsers support exists.

Note: The CSS should be validated when adding the CSS to your layouts while developing. For this purpose, the test can be performed using the command line tool.

Implementation: CSS gets minified and compressed.

Minifying: JavaScript

The JavaScript files added to the database get optimized using the as2js library (not working yet, soon I hope!). This library comes with a command line tool as well, although within the plugin we can directly use the library.

The as2js compiler actually takes AlexScript as input instead of just plain JavaScript. That means you can write classes as in C++ instead of prototypes as offered by JavaScript.

Implementation: Compiler currently fails.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly