PHP code example of fisharebest / laravel-assets
1. Go to this page and download the library: Download fisharebest/laravel-assets library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fisharebest / laravel-assets example snippets
return [
'providers' => [
Fisharebest\LaravelAssets\AssetsServiceProvider::class,
],
'aliases' => [
'Assets' => Fisharebest\LaravelAssets\AssetsFacade::class,
],
]
<!-- resources/views/layouts/master.blade.php -->
Assets::add(['jquery', 'bootstrap', 'global.js', 'style.css', 'analytics.js'])
<!-- resources/views/pages/list.blade.php -->
Assets::add('list.js')
<!-- resources/views/pages/list.blade.php -->
Assets::add(['jquery', 'list.js'])
<!-- resources/views/layouts/master.blade.php -->
<html>
<head>
{!! Assets::css() !!}
</head>
<body>
...
{!! Assets::js() !!}
</body>
</html>
Assets::add('http://example.com/script?parameter', 'js')
<!-- resources/views/layouts/master.blade.php -->
Assets::add('jquery.js')
{!! Assets::css('print', ['media' => 'print']) !!}
{!! Assets::js('analytics', ['async']) !!}
Assets::setGzipStatic(6);
Assets::css(); // will create compressed assets
// config/assets.php
return [
'destination' => 'min', // We create assets here
'destination_url' => 'http://my-cdn.com/min', // Users read assets from here
]
$ php artisan vendor:publish --provider="Fisharebest\LaravelAssets\AssetsServiceProvider"
php artisan assets:purge