RobinRadic / blade-extensions

Laravel Blade extensions like $loop->odd/$loop->index in foreach, view blocks and partials, etc
http://robin.radic.nl/blade-extensions
MIT License
267 stars 35 forks source link

BLADE-49 ⁃ Minification in compile time #46

Closed TheAliAbbasi closed 8 years ago

TheAliAbbasi commented 8 years ago

Is there anyways to make minification at view's compile time? I tried to use https://github.com/GrahamCampbell/Laravel-HTMLMin package to minify views at compile time but it breaks extensions from this package

RobinRadic commented 8 years ago

Not entirely sure what you mean. If you want to integrate your own minification logic using the directives the blade-extensions package is using, you could alter the config/blade_extensions.php config and add minify and endminify items to the blacklist array eg:

<?php
/**
 * Part of Radic - Blade Extensions
 *
 * @author         Robin Radic
 * @license        MIT License - http://radic.mit-license.org
 * @copyright  (c) 2011-2015, Robin Radic - Radic Technologies
 * @link           http://radic.nl
 */

return array(
    /*
    |---------------------------------------------------------------------
    | Blacklisting of directives
    |---------------------------------------------------------------------
    |
    | These directives will be excluded.
    |
    */
    'blacklist' => array('minify', 'endminify')
);

and afterwards implement your own logic.

Alternatively you could override/alter the blade.helpers binding, which containers the Radic\BladeExtensions\Helpers\HelperRepository class which in turn contains the Radic\BladeExtensions\Helpers\Minifier class that is responsible for minification.

It's failry easy to replace any of the minifaction logic and replace it with your own/vendor library. Feel free to create another issue if need more help.