PHP code example of idealogica / asset-grinder
1. Go to this page and download the library: Download idealogica/asset-grinder library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
idealogica / asset-grinder example snippets
$assetHandler = new Idealogica\AssetGrinder\AssetHandler(
ServerRequest::fromGlobals(),
__DIR__ . '/assets',
__DIR__ . '/public',
$_SERVER['HOME'] . '/.npm_global/bin/uglifyjs',
$_SERVER['HOME'] . '/.npm_global/bin/javascript-obfuscator'
);
$url = $assetHandler->buildAssetUrl('pack', ['asset1.js', 'asset2.js'], AssetHandler::TYPE_JS, false, false);