Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pollen-solutions/asset
Pollen Solutions - Asset Component - Tools to manage assets in web applications
https://github.com/pollen-solutions/asset
php
Last synced: 6 days ago
JSON representation
Pollen Solutions - Asset Component - Tools to manage assets in web applications
- Host: GitHub
- URL: https://github.com/pollen-solutions/asset
- Owner: pollen-solutions
- License: mit
- Created: 2021-07-09T09:33:13.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-01-13T09:41:14.000Z (almost 2 years ago)
- Last Synced: 2024-08-07T02:57:40.373Z (4 months ago)
- Topics: php
- Language: PHP
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Asset Component
[![Latest Stable Version](https://img.shields.io/packagist/v/pollen-solutions/asset.svg?style=for-the-badge)](https://packagist.org/packages/pollen-solutions/asset)
[![MIT Licensed](https://img.shields.io/badge/license-MIT-green?style=for-the-badge)](LICENSE.md)
[![PHP Supported Versions](https://img.shields.io/badge/PHP->=7.4-8892BF?style=for-the-badge&logo=php)](https://www.php.net/supported-versions.php)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
```bash
composer require pollen-solutions/asset
```## Basic Usage
```php
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