via composer
, (*1)
composer require ahmed-aliraqi/laravel-assets:dev-master
In your config/app.php
file add this command in the providers
array, (*2)
Aliraqi\Assets\Providers\AssetsServiceProvider::class,
php artisan vendor:publish --tag=laravel-asset,
config/assets.php
file :, (*3)
<?php return [ 'scripts' => [ 'jquery' => 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js', 'jquery-ui' => 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', 'bootstrap' => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js', 'vue' => 'https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.4/vue.min.js', 'select2' => 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js', 'datatables' => [ 'https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.15/js/jquery.dataTables.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/fixed-data-table/0.6.4/fixed-data-table.min.js', ], ], 'styles' => [ 'bootstrap' => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css', 'components' => [ env('APP_URL') . '/css/core.css', env('APP_URL') . '/css/fontawesome.css', env('APP_URL') . '/css/components.css', ], ], ];
{{ scripts('jquery') }}
or, (*4)
@scripts('jquery')
result :, (*5)
<script type="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
for multiple paths :, (*6)
@scripts('datatables')
result :, (*7)
{{ styles('bootstrap') }} {{ styles('components') }}
or, (*8)
@styles('bootstrap') @styles('components')
result :, (*9)
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css"> <link href="http://localhost/css/core.css" rel="stylesheet" type="text/css"> <link href="http://localhost/css/fontawesome.css" rel="stylesheet" type="text/css"> <link href="http://localhost/css/components.css" rel="stylesheet" type="text/css">