1. Go to this page and download the library: Download userfrosting/assets 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/ */
userfrosting / assets example snippets
use UserFrosting\UniformResourceLocator\ResourceLocator;
use UserFrosting\Assets\Assets;
$basePath = __DIR__;
$baseUrl = 'https://assets.userfrosting.com/';
$locator = new ResourceLocator($basePath);
$locator->registerStream('assets', '', [
'owls/assets',
'hawks/assets'
]);
$assets = new Assets($locator, 'assets', $baseUrl);
use UserFrosting\Assets\GulpBundleAssetsRawBundles;
// Load asset bundles.
$assetBundles = new GulpBundleAssetsRawBundles('../build/asset-bundles.json');
// Send loaded asset bundles to Assets instance.
$assets->addAssetBundles($assetBundles);
// Grab an asset bundle.
$assets->getJsBundleAssets('js/main');
// Outputs ["js/bootstrap-3.3.1.js", "js/crud.js"]
use UserFrosting\Assets\AssetsTemplatePlugin;
$assetsPlugin = new AssetsTemplatePlugin($assets);
// Some code that passes it to Twig rendering environment.