This repository contains a version of Minify updated to work as a FuelPHP package. For more information about Minify, check out the official repository.
- Clone (
git clone git://github.com/jyggen/Minify-FuelPHP
) or Download the package. - Minify should be located in fuel/packages/.
- Copy fuel/packages/minify/config/minify.php to fuel/app/config/minify.php and make your desired changes (if any).
- Add 'minify' to 'always_load/packages' in the config (or use
Fuel::add_package('minify')
in your code). - Success!
Minify::add('assets/css/normalize.css');
Minify::add('assets/css/base.css');
Minify::add('https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js');
Minify::add('assets/js/jquery.autocomplete.js');
Minify::add('assets/js/general.js');
Minify::run();
Minify::printLinks();
// You should in most cases use getLinks and assign it to your view though.
// $view->set('css_files', Minify::getLinks('css'), false);
// $view->set('js_files', Minify::getLinks('js'), false);
The above code will result in output similar to this:
<link rel="stylesheet" media="screen" href="/assets/compressed.css?beecb4f2">
<script src="/assets/compressed.js?ada7b8bb"></script>