PHP code example of pollen-solutions / asset
1. Go to this page and download the library: Download pollen-solutions/asset 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/ */
pollen-solutions / asset example snippets
use Pollen\Asset\AssetManager;
$asset = new AssetManager();
// Add inline CSS
$asset->addInlineCss(
'body {
background-color:AliceBlue;
}'
);
// Add inline JS
$asset->addInlineJs(
'console.log("value1");
console.log("value2");
console.log("value3");'
);
// Add global JS var
// -- app namespaced
$asset->addGlobalJsVar('test1', 'test-value1');
// -- in footer
$asset->addGlobalJsVar('test2', 'test-value2', true);
// -- in footer and without namespace
$asset->addGlobalJsVar('test3', 'test-value3', true, null);