1. Go to this page and download the library: Download ralfhortt/wp-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/ */
use RalfHortt\Assets\Style;
use RalfHortt\Assets\InlineScript;
use RalfHortt\Assets\LoginStyle;
(new Style('my-theme', get_stylesheet_directory_uri() . '/theme.css'))->register();
(new InlineScript('my-theme', 'const ThemeName = "Awesome";'))->register();
// Reuse a registered handle on another hook
(new Style('my-theme'))->register();
(new LoginStyle('my-theme'))->register();
use RalfHortt\Assets\Script;
(new Script(
'my-theme',
get_stylesheet_directory_uri() . '/app.js',
dependencies: ['wp-element'],
version: true,
args: ['strategy' => 'defer'],
))->register();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.