modseven / assets
Asset Module for Modseven
dev-master
2020-05-29 18:51 UTC
Requires
- ext-mbstring: *
- matthiasmullie/minify: ^1.3
- modseven/core: *
This package is auto-updated.
Last update: 2024-11-29 06:29:39 UTC
README
Modseven Assets Module
##Installation
composer require modseven/assets
..that's it.
##Configuration Copy the file(s) from vendor/modseven/assets/conf/ to your application/conf folder. Modify them as needed. The following configuration options are available for each type (js/css)
##Usage Here is a example of adding, files with and without dependencies
// Basic example
$assets = \Modseven\Assets\Assets::instance();
$assets->addCSS('mycssfilewithoutextension', ['dependency1', 'dependency2']);
// Another example, this will render bootstrap first then navbar
$assets = \Modseven\Assets\Assets::instance();
$assets->addCSS('navbar', ['bootstrap']);
$assets->addCSS('bootstrap');
// ...even this is again somewher in the code it will just render "bootstrap" once
$assets->addCSS('bootstrap');
After adding files simply include them in your view. Example:
<html lang='en'>
<head>
<title>Assets Demo</title>
<?php echo \Modseven\Assets\Assets::renderCSS(); ?>
</head>
<body>
<!-- YOUR BODY -->
</body>
</html>
Contributing
Any help is more than welcome! Just fork this repo and do a PR.
Special Thanks
Special Thanks to all Contributors and the Community!