Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[2.7][Asset] Framework config to support custom version strategy #15554

Closed
Labels
@xavierbriand

Description

@xavierbriand

The Framework bundle only implements two asset version strategies: empty and static (defaults provided by the Asset component).

If I want to use a custom strategy for my package (eg. to add the locale its path) without overriding the defaults, therecommended solution is to:

  • create a new service (my strategy)
  • use a compiler pass to extract the version and version format parameters from the default static strategy my package is compiled with
  • update the definition of my service with previously extracted parameters

If I have two packages with the same custom strategy but different versions, I need to duplicate my service declaration and update my compiler. And I cannot create services on-demand during the compiler pass. I could also create my own package configuration for my bundle that would override or extend the defaultassets.packages service.

It's neither convenient nor elegant.

I propose to add an optional parameter to set custom strategies:

#app/config/config.ymlframework:#...assets:base_urls://my.cdn.compackages:pdf:version:%version%version_format:/name/space/%%2$s/pdf%%1$slocalized_doc:version:%version%version_strategy:my.abstract.service.id# default is assets.static_version_strategy falling back on assets.empty_version_strategy if version is null (current behavior)version_format:/name/space/%%2$s/doc/%%3$s%/abc%1$s#%3$s would be my locale

A convenient abstractBaseVersionStrategy class could be provided that would declaresetVersion andsetVersionFormat to inject said parameters.

This solves a particular problem I have where I want to inject known parameters in an assetbase_urls orbase_path. Please provide your thoughts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp