Package Data | |
---|---|
Maintainer Username: | mmanos |
Maintainer Contact: | mark@airpac.com (Mark Manos) |
Package Create Date: | 2014-01-05 |
Package Last Update: | 2016-11-05 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-14 15:04:12 |
Package Statistics | |
---|---|
Total Downloads: | 2,620 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 10 |
Total Watchers: | 4 |
Total Forks: | 4 |
Total Open Issues: | 0 |
Casset is an asset manager for Laravel 4 applications. Some things it can do:
"vendor/package::/js/file.js"
Add this to your composer.json file, in the require object:
"mmanos/laravel-casset": "dev-master"
After that, run composer install to install Casset.
Add the service provider to app/config/app.php
, within the providers
array.
'providers' => array(
// ...
'Mmanos\Casset\CassetServiceProvider',
)
Add a class alias to app/config/app.php
, within the aliases
array.
'aliases' => array(
// ...
'Casset' => 'Mmanos\Casset\Facades\Casset',
)
Finally, ensure the cache directory defined in the config file is created and writable by the web server (defaults to public/assets/cache).
$ mkdir public/assets/cache
$ chmod -R 777 public/assets/cache
$ touch public/assets/cache/.gitignore
Edit public/assets/cache/.gitignore.
*
!.gitignore
Simply update the class alias in app/config/app.php
to point to the new Facade:
'aliases' => array(
// ...
'Casset' => 'Mmanos\Casset\Facades\Casset',
)
Add assets to the "default" container:
Casset::add('js/jquery.js');
Casset::add('less/layout.less');
Add assets to a custom container:
Casset::container('layout')->add('js/jquery.js');
Casset::container('layout')->add('less/layout.less');
Add an asset with a dependency on another asset:
Casset::add('less/variables.less');
Casset::add('less/layout.less', array(), array('less/variables.less'));
Add a global dependency for all assets (of the same file type):
Casset::dependency('less/variables.less');
Casset::container('layout')->dependency('less/variables.less');
Add assets from a composer package (vendorName/packageName):
Casset::add('frameworks/jquery::/jquery.min.js');
Render HTML tags to load assets for a container:
{{ Casset::container('default')->styles() }}
{{ Casset::container('layout')->scripts() }}
Generate a URL to an asset on the CDN server:
<img src="{{ Casset::cdn('logo.png') }}" />