catchamonkey / assetic-filter-bundle
该包的最新版本(v0.4.0)没有可用的许可证信息。
Catchamonkey AsseticFilterBundle
v0.4.0
2013-03-22 10:57 UTC
Requires
- php: >=5.3.3
- kriswallsmith/assetic: 1.1.*@dev
- symfony/framework-bundle: 2.*
This package is not auto-updated.
Last update: 2024-09-14 13:47:32 UTC
README
##CatchamonkeyAsseticFilterBundle
Symfony2 扩展包,提供一种以 assetic 过滤器的形式实现的 CSS 压缩器
##通过 Composer 安装
步骤 1)
composer require "catchamonkey/assetic-filter-bundle"
步骤 2) 在您的内核中注册此 Bundle
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Catchamonkey\Bundle\AsseticFilterBundle\CatchamonkeyAsseticFilterBundle(), ); }
##使用方法
使用过滤器非常简单,只需将其添加到样式表标签中即可
#app/Resources/views/base.html.twig {% stylesheets filter='catchamonkey_cssmin' '@AcmeDemoBundle/Resources/public/css/*.css' %} <link rel="stylesheet" type="text/css" href="{{ asset_url }}" /> {% endstylesheets %}
或者在 assetic 配置中使用 apply_to(自 v0.2.0 版本添加)
#app/config/config.yml # Assetic Configuration assetic: debug: %kernel.debug% use_controller: false bundles: [] filters: catchamonkey_cssmin: resource: "%kernel.root_dir%/../vendor/catchamonkey/assetic-filter-bundle/Catchamonkey/Bundle/AsseticFilterBundle/Resources/config/services.xml" apply_to: "\.css$"