alexandresalome / assetic-extra-bundle
Assetic(资产目录)的额外功能
v0.1.5
2014-02-04 12:47 UTC
Requires
- kriswallsmith/assetic: >=1.1,<2.0
README
为 Assetic 提供一个额外的过滤器: 资产目录.
此过滤器将处理您的CSS并将资源复制到目录,通常在 web/
文件夹中。
通过这种方式,您可以包含来自外部库的CSS图片和字体,而不需要在公共文件夹中存储依赖项。
安装
编辑您的 composer.json
文件,并将以下包添加为 require
{ "require": { "alexandresalome/assetic-extra-bundle": "dev-master" } }
编辑您的 app/AppKernel.php
文件,并将包添加到 registerBundles 方法中
public function registerBundles() { $bundles = array( // ... new Alex\AsseticExtraBundle\AlexAsseticExtraBundle(), // ...
配置
编辑您的 config.yml
文件,并添加一个名为 alex_assetic_extra 的部分
alex_assetic_extra: asset_directory: enabled: true # Indicates where assets should be copied to # when processing CSS files. path: %kernel.root_dir%/../web/assets # Not really clear yet target: assets
或快速使用
alex_assetic_extra: asset_directory: true
用法
要使用它,请在模板块的 {% stylesheets %}
中使用过滤器
{% stylesheets filter="combine,assetdirectory" "@SomeBundle/Resources/assets/form.css" "../vendor/path/to/some.js" %} {# ... #} {% endstylsheets %}
变更日志
v0.1
- 初始版本