getTemplateObject('JavascriptTag')->add(<<

Test of the PHP Assets manager

Basic usage

Instanciation of an assets loader:


Usage of the find() assets feature:

find("vendor/jquery.highlight.js"),'."\n"
	."\t".'$loader->find("vendor/jquery.metadata.js")'."\n"
    .');'."\n";
$js_stack = array(
	$loader->find('vendor/jquery.highlight.js'),
	$loader->find('vendor/jquery.metadata.js')
);
var_export($js_stack);
?>

Compressor feature

Merger

Merge of our stack of javascript files:

process();'."\n";
$compressor->process();

echo "\n";
echo '// asking the minifier in which file it generates the minified version of our files:'."\n";
echo '$minified_filename = $compressor->getDestinationRealPath();'."\n";
$merged_filename = $compressor->getDestinationRealPath();
echo '// => '.$merged_filename."\n";

echo "\n";
echo '// we can get a ready-to-use file path of the generated file defining the web root:'."\n";
$compressor->setWebRootPath( $loader->getDocumentRoot() );
echo '$compressor->setWebRootPath( $loader->getDocumentRoot() );'."\n";
echo '$minified_webpath = $compressor->getDestinationWebPath();'."\n";
$merged_webpath = $compressor->getDestinationWebPath();
echo '// => '.$merged_webpath."\n";

//var_export($merger);
?>

You can test merging javascript or css files of each demo page by setting URI arguments &merge_js=1 or &merge_css=1.

Minifier

Minification of a stack of javascript files:

setAdapterAction("minify");'."\n";
$compressor->setAdapterAction("minify");
echo '$compressor->process();'."\n";
$compressor->process();

echo "\n";
echo '// asking the minifier in which file it generates the minified version of our files:'."\n";
echo '$minified_filename = $compressor->getDestinationRealPath();'."\n";
$minified_filename = $compressor->getDestinationRealPath();
echo '// => '.$minified_filename."\n";

echo "\n";
echo '// we can get a ready-to-use file path of the generated file defining the web root:'."\n";
$compressor->setWebRootPath( $loader->getDocumentRoot() );
echo '$compressor->setWebRootPath( $loader->getDocumentRoot() );'."\n";
echo '$minified_webpath = $compressor->getDestinationWebPath();'."\n";
$minified_webpath = $compressor->getDestinationWebPath();
echo '// => '.$minified_webpath."\n";

//var_export($minifier);
?>

You can test minifying javascript or css files of each demo page by setting URI arguments &minify_js=1 or &minify_css=1.