rcm/expressive-assets

Simple asset loading

0.2.0 2017-06-29 19:49 UTC

This package is auto-updated.

Last update: 2024-04-11 13:57:21 UTC


README

Simple asset loading using Zend Expressive middleware

Configuration

'routes' => [
    // Asset route name MUST be used as the key
    'expressive-assets.public' => [
        // YOUR ROUTE NAME
        'name' => 'expressive-assets.public',
        // Path MUST contain fileName route param
        'path' => '/expressive-assets/{fileName:.*}',
        'middleware' => \ExpressiveAssets\AssetController::class,
        'options' => [],
        'allowed_methods' => ['GET'],
        /* expressive asset config */
        'expressive-asset' => [
            // Directory where assets are publicly available
            'directory' => __DIR__ . '/../public',
            // File extension to response headers, 
            // If headers value is not supplied 
            // then \ExpressiveAssets\CommonHeaders will be used
            'headers' => [
                'css' => [
                    'content-type' => 'text/css'
                ],
                'html' => [
                    'content-type' => 'text/html'
                ],
                'js' => [
                    'content-type' => 'application/javascript'
                ],
            ]
        ]
    ],
],