2017 © Pedro Peláez
 

library laravel-asset-manager

Allows for assets like js and css to be easily managed and called in Laravel

image

sudomabider/laravel-asset-manager

Allows for assets like js and css to be easily managed and called in Laravel

  • Sunday, January 29, 2017
  • by sudomabider
  • Repository
  • 2 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 7 % Grown

The README.md

Simple Asset Manager for Laravel

Build Status StyleCI, (*1)

Installation

  1. Run composer require sudomabider/laravel-asset-manager
  2. Add Sudomabider\AssetManager\AssetManagerServiceProvider::class to app config providers array
  3. Run php artisan vendor:publish --provider="Sudomabider\AssetManager\AssetManagerServiceProvider" --tag="config"

Configuration

All the assets are defined as key-value pairs in the assets array. The key would then be used in the view files to include the resources, e.g. @css('animate')., (*2)

The value part allows for 3 types of formats., (*3)

  • simple resource url:
'css' => 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css'
  • arrays of resource urls
'js' => [
    'https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/jquery.dataTables.min.js',
    'https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/dataTables.bootstrap.min.js'
]
  • js also accepts an array of options. Note in this case the whole js asset must be wrapped in an array
'js' => [
    ['https://cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js', ['data-pace-options' => '{ "ajax": false }']]
]

which outputs, (*4)

<script data-pace-options='{ "ajax": false }' type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js'></script>

This can be used together with the 2nd format, (*5)

Example usage

config/asset-manager.php, (*6)

'assets' => [
    'animate' => [
            'css' => 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css'
    ],
    'tagsinput' => [
        'css' => 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.css',
        'js' => 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.min.js'
    ],
    'datatables' => [
        'css' => 'https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/dataTables.bootstrap.min.css',
        'js' => [
            'https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/jquery.dataTables.min.js',
            'https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/dataTables.bootstrap.min.js'
        ]
    ],
    ...
]

view.blade.php, (*7)

@css('animate', 'tagsinput', 'datatables')

@js('tagsinput', 'datatables')

This will create asset inclusions in your html with the corresponding urls., (*8)

You can also call urls directly, (*9)

@css('https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css')

The Versions

29/01 2017

dev-master

9999999-dev

Allows for assets like js and css to be easily managed and called in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Veo Chen

laravel css assets js

29/01 2017

0.1.5

0.1.5.0

Allows for assets like js and css to be easily managed and called in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Veo Chen

laravel css assets js

28/01 2017

dev-analysis-qrYxYG

dev-analysis-qrYxYG

Allows for assets like js and css to be easily managed and called in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Veo Chen

laravel css assets js

09/01 2017

0.1.4

0.1.4.0

Allows for assets like js and css to be easily managed and called in Laravel

  Sources   Download

MIT

The Requires

 

by Veo Chen

laravel css assets js

13/09 2016

0.1.3

0.1.3.0

Allows for assets like js and css to be easily managed and called in Laravel

  Sources   Download

MIT

The Requires

 

by Veo Chen

laravel css assets js

12/09 2016

0.1.2

0.1.2.0

Allows for assets like js and css to be easily managed and called in Laravel

  Sources   Download

MIT

The Requires

 

by Veo Chen

laravel css assets js

06/09 2016

0.1

0.1.0.0

Allows for assets like js and css to be easily managed and called in Laravel

  Sources   Download

MIT

The Requires

 

by Veo Chen

laravel css assets js