2017 © Pedro Pelรกez
 

library asset-bundle

Asset management for aura v2

image

aura/asset-bundle

Asset management for aura v2

  • Sunday, December 21, 2014
  • by pmjones
  • Repository
  • 1 Watchers
  • 6 Stars
  • 172 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Aura.Asset_Bundle

Asset management for PHP., (*1)

Foreword

Requirements

This package requires PHP 5.3 or later. Unlike Aura library packages, this asset package has userland dependencies:, (*2)

Installation

This asset-bundle is installable and autoloadable via Composer with the following require element in your composer.json file:, (*3)

"require": {
    "aura/asset-bundle": "2.*"
}

Tests

Build Status, (*4)

composer install
phpunit -c tests/unit

PSR Compliance

This kernel attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request., (*5)

Community

To ask questions, provide feedback, or otherwise communicate with the Aura community, please join our Google Group, follow @auraphp on Twitter, or chat with us on #auraphp on Freenode., (*6)

Structure of Package

Assume you have a Vendor.Package. All your assets should be in the web folder. The folder names css, images, js can be according to your preffered name., (*7)

โ”œโ”€โ”€ src
โ”‚ย ย  โ”œโ”€โ”€ Cli
โ”‚ย ย  โ””โ”€โ”€ Web
โ”œโ”€โ”€ tests
โ””โ”€โ”€ web
    โ”œโ”€โ”€ css
    โ”‚ย ย  โ””โ”€โ”€ some.css
    โ”œโ”€โ”€ images
    โ”‚ย ย  โ”œโ”€โ”€ another.jpg
    โ”‚ย ย  โ””โ”€โ”€ some.png
    โ””โ”€โ”€ js
        โ””โ”€โ”€ hello.js

Assuming you have the same structure, now in your template you can point to /asset/vendor/package/css/some.css, /asset/vendor/package/js/hello.js, /asset/vendor/package/images/another.jpg., (*8)

Onething you still need to make sure in the name asset/vendor/package, (*9)

vendor/package which is the composer package name., (*10)

Usage in any project

Add path to the router, according to the router you are using so that vendor, package and file name can be extracted from it., (*11)

An example of usage with Aura.Router and Aura.Dispatcher is given below. The dispacther is used for it need to recursively call the __invoke method. Else action will return responder, then you need to invoke responder to get the response and finally do send the response., (*12)

 '/path/to/web/where/css/js/etc/',
    'my/package2' => '/path/to/web/where/css/js/etc/of/packag2'
);
$types = array();
$router->add('aura.asset', '/asset/{vendor}/{package}/{file}')
    ->setValues([
        'action' => 'aura.asset',
    ])
    ->addTokens(array(
        'file' => '(.*)'
    ));

$dispatcher->setObject(
    'aura.asset',
    function () use ($map, $types) {
        $action = new \Aura\Asset_Bundle\AssetAction(
            new \Aura\Asset_Bundle\AssetService($map, $types),
            new \Aura\Asset_Bundle\AssetResponder()
        );
        return $action;
    }
);
```

In your layout or view

```php

```

## Usage in Aura.Web_Kernel

```php
params['Aura\Asset_Bundle\AssetService']['map']['cocoframework/example'] = dirname(__DIR__) . '/web';
    }
```

Make sure you have router helper defined for Aura.View.

```php


The Versions

21/12 2014

dev-master

9999999-dev

Asset management for aura v2

  Sources   Download

BSD-2-Clause

The Requires

 

21/12 2014

2.1.0

2.1.0.0

Asset management for aura v2

  Sources   Download

BSD-2-Clause

The Requires

 

13/11 2014

2.0.0

2.0.0.0

Asset management for aura v2

  Sources   Download

BSD-2-Clause

The Requires