minifyRegistered is not maintained anymore. It maybe does not work in Evolution 1.1 anymore. Please fork it and bring it back to life, if you need it.
Collect the registered javascripts and css files and minify them by minify (https://github.com/mrclay/minify) for the MODX Evolution content management framework
With this plugin all js and css files added by the MODX API functions regClientStartupScript
, regClientScript
, regClientCSS
, regClientStartupHTMLBlock
and regClientHTMLBlock
are checked to minify them by minify
- Upload all files into the new folder assets/plugins/minifyregistered
- Create a new plugin called minifyRegistered with the following code
include(MODX_BASE_PATH.'assets/plugins/minifyregistered/minifyregistered.plugin.php');
- Check the event
OnLoadWebDocument
andOnWebPagePrerender
in the plugin configuration (Note 1).
The Package could be installed directly by Package Manager.
Optionally you can alter the plugin configuration with the following config string
&groupJs=Group minified files in `groupFolder`:;list;yes,no;yes
&groupFolder=Group files in this folder with `groupJs` enabled:;text;assets/js
&minPath=Path to a working minify installation:;text;/min/
&excludeJs=Comma separated list of files (including pathnames) not to be minified:;text;
Property | Description | Default |
---|---|---|
groupJs | Group minified files in groupFolder (Note 2) |
yes |
groupFolder | Group files in this folder with groupJs enabled |
assets/js |
minPath | Path to a working minify installation | /min/ |
excludeJs | Comma separated list of files (including pathnames) not to be minified | - |
- The plugin has to work before the Quick Manager+ Plugin (if you want to use Quick Manager+). Edit Plugin Execution Order and drag minifyRegistered plugin before Quick Manager+
- Grouping all registered javascripts in
assets/js
could change the inclusion order of the registered javascripts. - Not minified files are included later than the grouped minified and minified files.
- Registered chunks (i.e. javascript code) are included at the last position of head/body.
- The order of inclusion is external, grouped minified, minified, not minified and direct code.
- The Plugin needs a working installation of minify (https://github.com/mrclay/minify) in the folder
/min
in the webroot (the path could be changed in plugin configuration). - If you want to use the MODX cache folder for minify, you should insert the following line in
min/config.php
$min_cachePath = dirname(dirname(realpath($_SERVER['SCRIPT_FILENAME']))).'/assets/cache/minify';
- The media attribute of the link tag is not used