1. Go to this page and download the library: Download sympress/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/ */
sympress / assets example snippets
use SymPress\Assets\Script;
$script = (new Script('site', plugin_dir_url(__FILE__) . 'assets/site.js'))
->withAttributes(['crossorigin' => 'anonymous']);
use SymPress\Assets\Asset;
use SymPress\Assets\Script;
$filter = static function (string $html, Asset $asset): string {
return str_replace('></script>', ' data-handle="' . esc_attr($asset->handle()) . '"></script>', $html);
};
$script = (new Script('site', plugin_dir_url(__FILE__) . 'assets/site.js'))
->withFilters($filter);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.