承接 lb/neos-hashed-asset-uri 相关项目开发

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

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

lb/neos-hashed-asset-uri

最新稳定版本:v1.0.0

Composer 安装命令:

composer require lb/neos-hashed-asset-uri

包简介

A tiny Neos/Flow package that provides an Eel helper to generate cache-busting URIs for static resources.

README 文档

README

A tiny Neos/Flow package that provides an Eel helper to generate cache-busting URIs for static resources.

It appends a short content hash to the resource URL (as a ?v=... query parameter), so browsers will fetch a new version whenever the file content changes, while still allowing long-lived caching for unchanged assets.

Features

  • Eel helper HashedStaticResource available in the default Fusion context
  • Generates a content-based hash (first 10 chars of SHA-1) for the referenced static resource
  • Works with localized/static resources via Neos' StaticResourceHelper

Installation

Install via Composer in your Neos project:

composer require lb/neos-hashed-asset-uri

The package registers its Eel helper automatically via Settings.yaml, no further setup is required.

Usage

In Fusion, use the HashedStaticResource helper to build the URI of a static resource with cache busting:

prototype(Vendor.Site:Example) < prototype(Neos.Fusion:Component) {
    renderer = afx`
        <link rel="stylesheet" href={HashedStaticResource.uri('Vendor.Site', 'Public/Css/index.css')} />
        <script src={HashedStaticResource.uri('Vendor.Site', 'Public/JavaScript/index.js')}></script>
    `
}

Signature:

  • HashedStaticResource.uri(packageKey: string, pathAndFilename: string, localize: boolean = false): string

Examples:

  • CSS: HashedStaticResource.uri('Vendor.Site', 'Public/Css/index.css')
  • JS: HashedStaticResource.uri('Vendor.Site', 'Public/JavaScript/index.js')

The generated URLs look like:

/_Resources/Static/Packages/Vendor.Site/Public/Css/index.css?v=1a2b3c4d5e

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-16