MODX Minify is a MODX Extra to group and minify your CSS, SCSS, LESS and JS files. You can create groups, and each group can contain multiple files of the same type. So for instance you create a group named 'css' where you can add all your css, scss and less files. By calling the MODX Minify snippet inside a tag in your head a minified css file will be generated and cached which will contain all your files grouped and minified!
- Install the package via Package Management
- Add groups and files via the manager page
- Inside your in your template, place the snippet call, for example:
The MODX Minify snippet generates one minified file from all the files added to your specified group. The snippet automatically detects changes in your files, and also checks for changes made in the CMP (adding, updating, removing or reordering of files).
You can also combine multiple groups into one minified file, by using a comma-separated list of groups in your snippet call:
In the above example all the files from group 'css' and 'css2' get combined into one minified CSS file.
Feature requests and issues
Feature requests and issues can be reported on the MODX Minify Github page at https://github.com/Sterc/modx-minify
This is a free extra and the code is publicly available for you to change. The extra is being actively maintained and you're free to put in pull requests which match our roadmap. Please create an issue if the pull request differs from the roadmap so we can make sure we're on the same page.
New in ModxMinify 1.0.1
Changelog for ModxMinify.
- Add missing less.php library
- Fix bug with hardcoded 'modx' prefix in build (#9 and #25)
- Add cachepath and cache_url settings to override path to minified file (PR#27) - Thanks to @digitalpenguin
- Update composer dependencies
- Remove twig from composer dependencies for better compatibility (#32)
ModxMinify 1.0.0 (2017-01-24)
- First public release
ModxMinify 0.2.0 (2016-05-25)
- Added ability to combine multiple groups in one modxMinify call.
ModxMinify 0.1.9 (2016-02-11)
- Added plugin to clear ModxMinify cache files on Modx cache clear.
- Fixed exception bug in Leafo class
- Added (and removed :p) config.json for groups/files
ModxMinify 0.1.7 (2016-01-20)
- New css uri rewrite filter (for rewriting relative urls in css files)
- New css minify filter
- fix assetwriter paths