1. Go to this page and download the library: Download tatter/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/ */
tatter / assets example snippets
use Tatter\Assets\Asset;
$asset = new Asset('<link href="/assets/styles.css" rel="stylesheet" type="text/css" />');
echo view('main', ['asset' => $asset]);
namespace App\Bundles;
use Tatter\Assets\Asset;
use Tatter\Assets\Bundle;
class ColorBundle extends Bundle
{
protected function define()
{
$this
->add(Asset::createFromPath('styles.css')) // Add individual Assets
->merge($someOtherBundle); // Or combine multiple Bundles
// Create more complex Assets
$source = '<script src="https://pagecdn.io/lib/cleave/1.6.0/cleave.min.js" type="text/javascript"></script>';
$inHead = true; // Force a JavaScript Asset to the <head> tag
$asset = new Asset($source, $inHead);
}
}
namespace Config;
use Tatter\Assets\Config\Assets as AssetsConfig;
class Assets extends AssetsConfig
{
public $routes = [
'*' => [
'bootstrap/bootstrap.min.css',
'bootstrap/bootstrap.bundle.min.js',
'font-awesome/css/all.min.css',
'styles/main.css',
],
'files' => [
'dropzone/dropzone.min.css',
'dropzone/dropzone.min.js',
],
];
}
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array
*/
public $globals = [
'before' => [
// 'honeypot',
// 'csrf',
],
'after' => [
'assets' => ['except' => 'api/*'],
],
];
namespace App\Bundles;
use Tatter\Assets\Bundle;
class DropzoneJS extends Bundle
{
protected $paths = [
'dropzone/dropzone.min.css',
'dropzone/dropzone.min.js',
];
}