承接 kenshodigital/kirby-assets 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kenshodigital/kirby-assets

Composer 安装命令:

composer require kenshodigital/kirby-assets

包简介

Fingerprints static assets for cache busting in Kirby projects.

README 文档

README

Fingerprints static assets for cache busting in Kirby projects.

General

The plugin provides a namespaced assets() helper function that adds a fingerprint to the filename for a given asset path.

For example, an asset path like /assets/styles/example.css becomes /assets/styles/example.8e5a39d7.css.

Usage

Installation

composer require kenshodigital/kirby-assets ^1.0

Setup

Kirby

Fingerprinting is disabled by default and needs to be activated explicitly in your config.php.

<?php declare(strict_types=1);

return [
    'kensho.assets' => [
        'fingerprint' => true,
    ],
];

The plugin uses Kirby’s configured assets root and URL. By default, this is the assets directory relative to the document root.

Further reading

Server

For performance reasons, the plugin doesn’t resolve fingerprinted assets via PHP automatically and relies on a server rewrite instead. Make sure to add the following rewrite to your server configuration.

Caddy/FrankenPHP
uri path_regexp ^(/assets/.+)\.(?:[a-f0-9]{8})\.([^.]+)$ $1.$2
Nginx
rewrite "^(/assets/.+)\.(?:[a-f0-9]{8})\.([^.]+)$" $1.$2 last;

Development

In your controllers, templates or snippets, import the namespaced helper function and use it with the path to your asset file, relative to the configured assets root.

Depending on the configuration value for fingerprinting, this assets() function returns either the original or the fingerprinted URL to the asset file.

Controller

<?php declare(strict_types=1);

use function Kensho\Assets\asset;

return fn(): array => [
	'stylesheet' => asset(path: 'styles/example.css'),
];

Template or snippet

<?php declare(strict_types=1);

use function Kensho\Assets\asset;
?>
<link rel="stylesheet" href="<?= asset(path: 'styles/example.css') ?>">

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固