pollen-solutions / asset
Pollen Solutions - Asset Component - Manage CSS styles, JS scripts, ...
v1.0.10
2022-10-14 00:00 UTC
Requires
- php: ^7.4 || ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.4
- matthiasmullie/minify: ^1.3
- pollen-solutions/event: ^1.0
- pollen-solutions/http: ^1.0
- pollen-solutions/support: ^1.0
Requires (Dev)
- phpunit/phpunit: ^9.0
- roave/security-advisories: dev-latest
Suggests
- pollen-solutions/container: Pollen Solutions - Container Component - PSR-11 ready Dependencies Injection Container.
README
Pollen Solutions Asset Component provides tools to manage assets in web applications.
Allows adding of inline Css styles, adding of inline JS scripts or passing PHP vars to Js global vars to access them in your own scripts.
Installation
composer require pollen-solutions/asset
Basic Usage
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);
Register asset
@todo
Enqueue assets
@todo
Cache and Minification
Coming soon