agallou/twig-hashed-file-extension
Composer 安装命令:
composer require agallou/twig-hashed-file-extension
包简介
Include file containing content hash in twig templates
README 文档
README
The grunt-hash grunt plugin allows you to rename files according to their content.
The robo-hash task allows you to to the same in PHP.
For example a file named main.css will be renamed to main.54e79f6f.css.
So the file is not easy to include in a Twig template (its name will change at every content change).
This plugin adds a twig function called hashed_file.
Usage
You can call it like this :
$twig->addExtension(new \Agallou\TwigHashedFileExtension\Extension(__DIR__ . '/web/assets/', null));
<link rel="stylesheet" href="{{ hashed_file('css/main.css') }}" />
It will look for files called main*.css in the web/assets/css directory and serve it as /assets/main.54e79f6f.css.
If no file is found or more than one file is found an exception will be thrown.
agallou/twig-hashed-file-extension 适用场景与选型建议
agallou/twig-hashed-file-extension 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 591 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「twig」 「assets」 「hash」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 agallou/twig-hashed-file-extension 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 agallou/twig-hashed-file-extension 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 agallou/twig-hashed-file-extension 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
Asset Management for PHP
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
A Twig extension to insert css as inline styles with a tag
Caching and compression for Twig assets (JavaScript and CSS).
Article CSS-ID Frontend Output Optimization
统计信息
- 总下载量: 591
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-13