2017 © Pedro Peláez
 

library assetmanager-expressive

An assetmanager module for Zend Expressive.

image

wshafer/assetmanager-expressive

An assetmanager module for Zend Expressive.

  • Wednesday, December 27, 2017
  • by wshafer
  • Repository
  • 1 Watchers
  • 1 Stars
  • 45 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 32 % Grown

The README.md

codecov Scrutinizer Code Quality Build Status, (*1)

AssetManager For Zend Expressive

Fork of the original ZF2 Assetmanager By Wesley Overdijk and Marco Pivetta for use with Zend Expressive, (*2)

Introduction

This module provides functionality to load assets and static files from your module directories through simple configuration. This allows you to avoid having to copy your files over to the public/ directory, and makes usage of assets very similar to what already is possible with view scripts, which can be overridden by other modules. In a nutshell, this module allows you to package assets with your module working out of the box., (*3)

Installation

  1. Require assetmanager:, (*4)

    composer require wshafer/assetmanager-expressive
    
  2. Register the middleware. The trick here is to make sure this is the last middleware to run before returning any kind of "not found" responses. In a default pipeline, this would be placed just above the "NotFoundHandler" in pipeline.php, (*5)

    $app->pipe(\AssetManager\Expressive\MiddleWare\AssetManagerMiddleware::class);
    

Usage

Take a look at the wiki for a quick start and more information. A lot, if not all of the topics, have been covered in-dept there., (*6)

Sample module config:, (*7)

<?php
return array(
    'asset_manager' => array(
        'resolver_configs' => array(
            'collections' => array(
                'js/d.js' => array(
                    'js/a.js',
                    'js/b.js',
                    'js/c.js',
                ),
            ),
            'paths' => array(
                __DIR__ . '/some/particular/directory',
            ),
            'map' => array(
                'specific-path.css' => __DIR__ . '/some/particular/file.css',
            ),
        ),
        'filters' => array(
            'js/d.js' => array(
                array(
                    // Note: You will need to require the classes used for the filters yourself.
                    'filter' => 'JSMin',
                ),
            ),
        ),
        'caching' => array(
            'js/d.js' => array(
                'cache'     => 'Apc',
            ),
        ),
    ),
);

Please be careful, since this module will serve every file as-is, including PHP code., (*8)

Questions / support

If you're having trouble with the asset manager there are a couple of resources that might be of help. * The FAQ wiki page, where you'll perhaps find your answer. * Issue tracker. (Please try to not submit unrelated issues)., (*9)

The Versions