wshafer/assetmanager

此包已被 废弃 并不再维护。未建议替代包。

Zend Framework 的 assetmanager 模块。

2.0.0-beta2 2017-12-27 21:57 UTC

README

codecov Scrutinizer Code Quality Build Status

AssetManager For Zend Framework

ZF2 Assetmanager 衍生,作者为 Wesley OverdijkMarco Pivetta

简介

此模块旨在与 ZendSkeletonApplication 的默认目录结构一起使用。它通过简单的配置提供加载模块目录中资产和静态文件的功能。这允许您无需将文件复制到 public/ 目录,并且使用资产的方式与视图脚本相似,可以被其他模块覆盖。总之,此模块允许您直接与模块一起打包资产。

安装

  1. 需要 assetmanager
./composer.phar require wshafer/assetmanager:2.0.0-beta2

使用

请参阅 wiki 以获取快速入门和更多信息。许多主题,如果不是全部,都已在其中深入讨论。

示例模块配置

<?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',
                ),
            ),
        ),
        'view_helper' => array(
            'cache'            => 'Application\Cache\Redis', // You will need to require the factory used for the cache yourself.
            'append_timestamp' => true,                      // optional, if false never append a query param
            'query_string'     => '_',                       // optional
        ),
        'caching' => array(
            'js/d.js' => array(
                'cache'     => 'Apc',
            ),
        ),
    ),
);

请注意,由于此模块将作为原始文件提供每个文件,包括 PHP 代码,因此请谨慎使用。

问题 / 支持

如果您在使用资产管理器时遇到问题,以下资源可能会有所帮助。