2017 © Pedro Peláez
 

library asset-manager

image

administrcms/asset-manager

  • Thursday, September 8, 2016
  • by mirovit
  • Repository
  • 1 Watchers
  • 0 Stars
  • 878 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 1 % Grown

The README.md

Assets manager

Build Status Code Climate Test Coverage, (*1)

Installation

Using Composer:, (*2)

composer require administrcms/asset-manager

Add the service provider:, (*3)

\Administr\Assets\AssetsServiceProvider::class,

The Facade:, (*4)

'Asset'    => \Administr\Assets\AssetsFacade::class,

Usage

Base usage

The asset manager works with the Laravel framework. It provides a Facade for easier usage., (*5)

You can specify your asset groups by either the add method or using the magical method., (*6)

Asset::add('test.css', 'css');
// is the same as
Asset::addCss('test.css');

You can retrieve a group either by the get method or the magical equivelent., (*7)

Asset::get('css');
// is the same as
Asset::getCss();

You can also specify a priority for your asset. For example when using the jQuery library, you need to include it before any other library that depends on it., (*8)

// The sort is from highest to lowest priority. The default priority is 0.
Asset::addJs('jquery.js', 100);
Asset::add('jquery.js', 'js', 100);

Shortcuts

You can define a shortcut, which is a class that defines multiple assets at once. If you are using a js library that needs to include js and css code, you can make it easier., (*9)

// Create a class that implements the Shortcut contract
class WysiwygShortcut implements Administr\Assets\Contracts\Shortcut {
    public function execute()
    {
        Asset::addJs('tinymce.js');
        Asset::addCss('tinymce.css');
        Asset::addCss('tinymce.theme.css');
    }
}

// Register it with the Asset Manager
Asset::shortcut('wysiwyg', WysiwygShortcut::class);

// And then call it like a method of the Manager
Asset::wysiwyg();

It is up to you to decide where to register the shortcuts. A good place would be in a ServiceProvider in you Laravel app., (*10)

The Versions

08/09 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

08/09 2016

1.1.2

1.1.2.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

01/07 2016

1.1.1

1.1.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

01/07 2016

1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

08/02 2016

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

03/02 2016

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov