alpixel / assetversionbundle
此组件由我们的团队用于版本化资产
v0.1.1
2016-08-25 09:18 UTC
Requires
- php: >=5.3.0
- symfony/symfony: ~2.8|~3.0
This package is not auto-updated.
Last update: 2024-09-14 18:58:39 UTC
README
从 Symfony 3.3 开始,您应使用 https://symfony.com.cn/blog/new-in-symfony-3-3-manifest-based-asset-versioning
安装
- 安装包
composer require 'alpixel/assetversionbundle'
- 更新 AppKernel.php
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Alpixel\Bundle\AssetVersionBundle\AlpixelAssetVersionBundle(),
);
// ...
}
// ...
}
配置
使用 gulp 和 gulp-rev 或其他服务生成您的资产修订文件,然后在模板文件中使用我们的 Twig 扩展调用您的资产。
<link rel="stylesheet" type="text/css" media="screen" href="{{ asset('css/vendor.min.css'|asset_version) }}" />