A dynamic website almost requires the use of CSS and JavaScript. Using a Laravel asset package provides an easy way to manage these assets and include them in our views.
For this recipe, we'll need to use the code created in the Loading a view into another view/nested views recipe.
To complete this recipe, follow these steps:
Open the
composer.json
file and add theasset
package to therequire
section, so it looks similar to the following:"require": { "laravel/framework": "4.0.*", "teepluss/asset": "dev-master" },
In the command line, run composer update to download the package as follows:
php composer.phar update
Open the
app/config/app.php
file and addServiceProvider
to the end of the providers array as follows:'Teepluss\Asset\AssetServiceProvider',
In the same file, in the
aliases
array, add the alias for the package as follows:'Asset' => 'Teepluss\Asset\Facades\Asset'
In the
app/filters.php
file, add a custom filter for our assets...