xanweb / c5-ext-asset
Handle External Assets for Concrete5
v1.0.2
2020-03-31 09:41 UTC
Requires
- php: >=7.2
This package is auto-updated.
Last update: 2024-10-29 05:41:11 UTC
README
Register assets within any library under Concrete5 Assets System
Installation
Include library to your composer.json
composer require xanweb/c5-ext-asset
Usage
- To Register an asset you need to use your library name like the example below "xanweb/c5-js-cookie".
- Supported Asset Types: ['vendor-javascript', 'vendor-css']
- You can check the "xanweb/c5-js-cookie" library as example
<?php use Xanweb\ExtAsset\Asset\VendorAssetManager; VendorAssetManager::registerMultiple([ 'js-cookie' => [ ['vendor-javascript', 'js/js.cookie.min.js', 'xanweb/c5-js-cookie', ['minify' => false, 'version' => '3.0.0-beta.3']], ], ]); VendorAssetManager::registerGroup('myAsset/group', [ ['javascript', 'jquery'], ['vendor-javascript', 'js-cookie'], // Just as example. js cookie doesn't require any dependencies ['vendor-css', 'other/library'], ['css', 'some/core/asset'], ]);
To use the library, as usual you requireAsset method
<?php $g = \Concrete\Core\Http\ResponseAssetGroup::get(); $g->requireAsset('vendor-javascript', 'js-cookie');
License
The Concrete5 External Assets is open-sourced software licensed under the MIT license.