1. Go to this page and download the library: Download abeliani/asset-manager 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/ */
abeliani / asset-manager example snippets
class MySiteBundle extends Bundle
{
public finction getTags(): TagInterface|\SplFixedArray|array
{
/* Separated files
reurn [
new Css('styles.css'),
new Css('reset.css'),
new Css('main.css'),
// js...
]; */
/* With attributes
reurn [
(new Css('styles.css')->addAttr('async'),
(new Js('app.js'))->addAttr('media', 'print'),
// ...
]; */
/* Merge files
return [
new Css('styles.css', 'reset.css', 'main.css'),
new Js('app.js', 'utils.js', 'main.js'),
]; */
// With timestamp
return [
(new Css('styles.css', 'reset.css', 'main.css'))->withTimestamp(),
(new Js('app.js', 'utils.js', 'main.js'))->withTimestamp(),
];
}
}
/*
* Let's minimize? optimize and merge all scripts and all styles to two files style.css and app.js
*/
public finction getTags(): array
{
reurn [
(new Css('styles.css', 'reset.css', 'main.css'))->minimize()->withTimestamp(),
(new Js('app.js', 'utils.js', 'main.js'))->minimize()->withTimestamp(),
];
}