2017 © Pedro Peláez
 

package laravel-assets

image

ahmed-aliraqi/laravel-assets

  • Thursday, August 3, 2017
  • by ahmed-aliraqi
  • Repository
  • 0 Watchers
  • 4 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Installition

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,

Generate the config file :

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',
        ],
    ],

];

usage in blade files

{{ 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 files :


{{ 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">

The Versions

03/08 2017

dev-master

9999999-dev

  Sources   Download

MIT

by Avatar ahmed-aliraqi