Page 1 of 1

understanding how to use a jS minification package

Posted: Thu Jun 04, 2015 1:07 am
by gautamz07
hey guys how do i use this package

https://github.com/ceesvanegmond/minify

its for minifying JS scripts :(

i see the script below :

Code: Select all

<?php
$config = array(
    'ignore_environments' => 'local',
    'js_build_path' => '/js/builds/',
    'css_builds_path' => '/css/builds',
)
$minify = new CeesVanEgmond\Minify\Providers\Javascript($public_path);
$minify->add($file)

if (in_array($environment, $config['ignore_environments']))
{
    return $provider->tags();
}

if ( ! $minify->make($config['css_build_path'] ) {
    $filename = $provider->tag($config['css_build_path'] . $provider->getFilename());
}

$provider->minify();

$filename = $provider->tag($config['css_build_path'] . $provider->getFilename());
but its not very descriptive about what its doing .

can somebody help me out here ?

Thank you.

Gautam.

Re: understanding how to use a jS minification package

Posted: Thu Jun 04, 2015 6:45 am
by Celauran
Looks like he's gotten his variables mixed up; $minify clearly instantiates a provider, which he later refers to as $provider. Take a look through the provider code. Should become pretty clear.

Re: understanding how to use a jS minification package

Posted: Fri Jun 05, 2015 5:27 am
by gautamz07
OK thanks celauran .