[config] section

Custom sections

Custom sections define various different configurations to be applied to
different types of files, e.g. you could have a javascript and a css section.

One parameter must exist, “files’, which declares files to include or exclude
from that section, e.g. the following section will only deal with javascript
files in http/includes/js/ excluding my-exclude.js:

one * indicates to match any file with a pattern only in the current directory

two * indicates to recursively match any file with the pattern

File parameters

For each file that is matched, various parameters are assigned to it, which can
be used by plugins. To add parameters, you can define them in a
default.keyname = value syntax, or use matches from the input filename.

E.g. for the following structure:

http/includes/javascript/file1.js

http/includes/javascript/file2.js

The following configuration will assign the parameter “output” the value
“http/includes/site.js”, the parameter “package” the values “file1” and “file2”
for each file respectively, and the parameter “filename” with the full path to
each file:

Plugins

It is built up from PHP classes, which plug into the core. To enable plugins,
define them in the [config] section. The order of the plugins is important, as
they will be run in order. E.g. filter must come before file and gzip otherwise
nothing will be done to the output.

[config]plugins=autoMatch, filter, file, gzip

The plugins are:

AutoMatch

A helper plugin which adds settings from the configuration based on file matches.

File

A plugin that concatenates and stores the contents of input files into output files.

Filter

A plugin that filters the contents of input files and passes the result onto the next plugin.

Gzip

A plugin, like File, but Gzips the contents of the output files.

AutoMatch

AutoMatch will match any input file that has a parameter matched with a PREG
expression, and add its defined defaults to that file’s parameters.

Default AutoMatch configuration comes with the optimizer to perform the best
combination of filters to css and javascript files, however you can define
additional configurations. E.g. this will add configuration to minify any input
matches that have a jquery-style filename:

You can also use an input file’s parameters in the output filename, e.g.
the following will, for each subdirectory of the javascript folder,
concatenate all javascript files, and store in seperate files per subdirectory.