understanding how to use a jS minification package

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

understanding how to use a jS minification package

Post 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.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: understanding how to use a jS minification package

Post 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.
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: understanding how to use a jS minification package

Post by gautamz07 »

OK thanks celauran .
Post Reply