Download the PHP package slushie/laravel-assetic without Composer
On this page you can find all versions of the php package slushie/laravel-assetic. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-assetic
Laravel-Assetic
Easily integrate Assetic with Laravel 4.
Key Features
- Easily maintain assets within groups.
- Instant single file compilation, concatenation, and minification.
- Apply multiple filters to each group.
- Automatically updates output files when their inputs have been changed.
- Pre-compile assets using
artisan asset:warm
.
Usage
Add to your composer.json:
After running composer update
, you need to add the service provider (and optionally, alias the Asset
facade) in your app/config/app.php
file:
Once your app's configuration has been updated, generate the package config:
Now the laravel-assetic configuration file will be available at:
Finally, edit the configuration file file to define your assets. You can define multiple groups, each with different filters and assets.
Defining Filters
Filters are defined within the package configuration file.
Adding Assets to Groups
Each group defines assets
and filters
as inputs, and an output
file that should be included in your view.
Using Assets in Views
Once defined, your groups can then be accessed from within your views using the Asset
facade.
To link to the main_js
group, you can use the Asset::url()
method as follows:
This will output the URL to the asset file (in this example, /scripts.js
).
When the page loaded, Assetic will generate the file, joining all files and running the defined filters.
You can also generate the asset output files via the artisan command:
Of course, this can be performed as a composer post-install
command to generate assets at deployment time.
More Information
More information can be acquired by reading through the source, which is fully documented, or you may feel free to raise issues at https://github.com/slushie/laravel-assetic/issues