slamecka / timestamp
添加了n:src和n:href宏,这些宏将时间戳作为参数附加到路径上(例如main.js?512a45c4)
dev-master
2016-02-23 14:39 UTC
Requires
- php: >=5.3.0
- nette/nette: 2.*
This package is not auto-updated.
Last update: 2024-09-14 14:34:48 UTC
README
添加宏n:src
和n:href
<script n:src="/main.js"></script>
<link n:href="style.css">
以生成类似以下代码:
<script src="/main.js?512a45c4"></script>
<link href="style.css?512a45c4">
其中512a45c4
是时间戳,该时间戳在您修改文件时自动更改(它是文件系统的mtime)。
请注意,您不必也不能使用{$basePath}
与这些宏一起使用,因为这些路径都是按照$basePath . '/' . $fileName
的方式构造的。
安装
$ composer require slamecka/timestamp:dev-master
在您的config.neon中
nette:
latte:
macros:
- TimestampMacro
MIT许可