This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".  
Status: 2023-12-31

Minify


init

minifies all *.css and *.js files found in the given folder and beneath - recursively. The results are being cached so it will only run once if there are changes made to css/js files.

init(array $aContentFilterMinify = array()) : bool
  • if leaving $aContentFilterMinify empty, the MVC_PUBLIC_PATH (/public/) will be scanned recursively.

Example: minify css/js in given folders

\MVC\Minify::init(array(
    Config::get_MVC_PUBLIC_PATH . '/Emvicy/styles/',
    Config::get_MVC_PUBLIC_PATH . '/Emvicy/scripts/',
));

Activating via Event Listener

\MVC\Event::processBindConfigStack([

    'mvc.reflex.reflect.targetObject.before' => [
        // minify css/js files
        function(\MVC\DataType\DTArrayObject $oDTArrayObject) {
            \MVC\Minify::init();
        },
    ],
]);

If you created a module using emvicy (see Creating a Module) you will already find an Activation via Event Listener in /modules/{module}/etc/event/default.php:

Emvicy Minify


minifyCss

creates a minified CSS file.

minifyCss(\SplFileInfo $oSplFileInfo) : bool

minifyJs

creates a minified JS file.

minifyJs(\SplFileInfo $oSplFileInfo) : bool