Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Static Web Assets] Define mechanism to fingerprint an asset relative path and generate new endpoints for it. #54874

Closed
Tracked by #52824
javiercn opened this issue Apr 1, 2024 · 1 comment
Assignees
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-static-web-assets
Milestone

Comments

@javiercn
Copy link
Member

javiercn commented Apr 1, 2024

  • We will support defining tokens in the relative path, very similar to how tokens work in ASP.NET Core routing that will be substituted at the time we compute the file path and respective endpoint routes with specific values.

For example, fingerprinting a file is specified as _path/to/file[.{fingerprint}].ext

  • [.{fingerprint}] is a replacement expression that indicates where the fingerprint needs to go and what other literals (very much like complex segments) need to be applied when the fingerprint is used, so that the final result can be file.fingerprint.extension or file.extension. We don't make any assumption on where the fingerprint or its format needs to be.
  • The {fingerprint} in the relative path is used through the pipeline to identify what endpoints to define and their paths.
  • A given expression like the above can be optional if suffixed by ? as for example _path/to/file[.{fingerprint}]?.ext to mean the following:
    • Make the file routable through the fingerprinted endpoint if possible in addition to its regular path but do not fingerprint the actual file path on disk.
      • This is because there are some files we don't have control of (like CSS) and we want to make sure that those assets are still reachable through their original paths.

Whenever we need to use the endpoints, we resolve the fingerprint based on the asset to compute the final paths for files and routes for endpoints.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Apr 1, 2024
@javiercn javiercn self-assigned this Apr 1, 2024
@javiercn javiercn added this to the 9.0-preview4 milestone Apr 1, 2024
@javiercn javiercn added the area-blazor Includes: Blazor, Razor Components label Apr 1, 2024
@mkArtakMSFT mkArtakMSFT removed the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label May 13, 2024
@mkArtakMSFT mkArtakMSFT added enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-static-web-assets labels May 29, 2024
@javiercn
Copy link
Member Author

#56045

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-static-web-assets
Projects
None yet
Development

No branches or pull requests

3 participants
@javiercn @mkArtakMSFT and others