dev-master
9999999-dev
MIT
The Requires
- php >=5.3.0
- illuminate/support 4.1.*
- kriswallsmith/assetic dev-master
- nitra/php-min @dev
- patchwork/jsqueeze dev-master
by Dominik Hardtke
Wallogit.com
2017 © Pedro Peláez
Assetie is my laravel package for managing assets in Laravel 4. It uses Kris Wallsmith's great Assetic for it's minifying and compressing of asset files., (*1)
This package is still wip, that means it is in an early stage and needs much work that has to be done until Assetie can be used in a production environment!, (*2)
I tried several products over time and wasn't happy with them at all., (*3)
All I've wanted was a package which would be easy to use, clean and fast at the same time., (*4)
Require Assetie by adding it to the "require" key of the composer.json file:, (*5)
"dhardtke/assetie": "dev-master"
Run "composer update" to update all your dependencies and install Assetie., (*6)
Include Assetie in your Laravel project by adding it to the app's config:, (*7)
In app/config/app.php:, (*8)
'Dhardtke\Assetie\AssetieServiceProvider' to the 'providers' array'Collection' => 'Dhardtke\Assetie\Facades\Collection' to the aliases arrayThat's it! Now you can start managing your assets., (*9)
Run php artisan config:publish dhardtke/assetie from the command line in your Laravel installation directory to publish Assetie's config file., (*10)
Then you can edit app/config/packages/dhardtke/assetie/config.php as follows:, (*11)
'filters' => array(
'.min.js' => array(
),
'.min.css' => array(
new \Assetic\Filter\CssRewriteFilter,
$uglifyCss,
new \Assetic\Filter\PhpCssEmbedFilter
),
'.js' => array(
$JSqueeze
),
'.less' => array(
$lessFilter,
$uglifyCss
),
'.css' => array(
new \Assetic\Filter\CssRewriteFilter,
$uglifyCss,
new \Assetic\Filter\PhpCssEmbedFilter
),
)
Add specific Assetic filters to certain extensions. See the appropriate Assetic filters overview for more details., (*12)
'directories' => array(
'javascripts' => 'assets/javascripts',
'stylesheets' => 'assets/stylesheets'
),
These are the directories where Assetie will look for it's JavaScript and Stylesheet-Files. If you want to change them, you can do it here. These paths are relative to the app path., (*13)
'build_path' => 'builds',
If you want, you can change the directory where Assetie will store it's builds. By default it is set to app_public() . /builds, but if you want you can change it here., (*14)
This path is always relative to the public path of Laravel, (*15)
Create a file called collections.php next to your routes.php. That file will be automatically included by Assetie and holds your Asset Collections., (*16)
To create your own, first collection you have to use the following code inside of your collections.php:, (*17)
Collection::addCollection("base", function($collection) {
$collection->add([
"style.css",
"base.js"
]);
});
You can now start using this collection by calling this function in your template (typically in your <head>):, (*18)
{{ Collection::stylesheets("base"}}
{{ Collection::javascripts("base"}}
If you now want to have a new collection that inherits the base collection, you can do it like this:, (*19)
Collection::addCollection("portal", function($collection) {
$collection->includeCollection("base")
->add("portal.css");
});
MIT