Skip to content

Add Data.Artifacts to css.Build and js.Build - #15175

Merged
bep merged 1 commit into
gohugoio:masterfrom
bep:feat/cssbuild-artifacts-15173
Aug 8, 2026
Merged

Add Data.Artifacts to css.Build and js.Build#15175
bep merged 1 commit into
gohugoio:masterfrom
bep:feat/cssbuild-artifacts-15173

Conversation

@bep

@bep bep commented Aug 8, 2026

Copy link
Copy Markdown
Member

Artifacts are the additional output files published as part of the build:
source maps and files emitted by ESBuild's file loader (e.g. fonts). Each
artifact provides Permalink, RelPermalink and MediaType, so e.g. font
preload links can be constructed in templates.

Also add media type definitions for source maps (application/source-map),
font/woff and font/woff2.

Fixes #15173

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

@bep
bep requested a lite review from Copilot August 8, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes additional output files produced during css.Build/js.Build (e.g. source maps and ESBuild file-loader outputs like fonts) to templates via Resource.Data.Artifacts, and adds default media types needed to label these artifacts correctly.

Changes:

  • Add resources.Artifact and populate ResourceTransformationCtx.Data["Artifacts"] during ESBuild processing.
  • Add integration tests validating artifact presence/links for both css.Build and js.Build.
  • Extend builtin media types to include source maps and WOFF/WOFF2.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tpl/css/build_integration_test.go Adds coverage for .Data.Artifacts in css.Build, including fonts and external sourcemap.
resources/transform.go Clarifies Data serialization expectations and fixes related documentation wording (plus a comment typo).
resources/resource_transformers/js/js_integration_test.go Adds coverage for .Data.Artifacts in js.Build with external sourcemap.
resources/resource_transformers/js/build.go Collects/publishes artifacts from ESBuild output and exposes them via .Data.Artifacts.
resources/artifact.go Introduces the resources.Artifact interface and implementation returned to templates.
media/config_test.go Updates default media type tests for new builtin types.
media/builtin.go Adds builtin media types and suffix mappings for source maps and WOFF/WOFF2.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread resources/resource_transformers/js/build.go Outdated
Comment thread resources/transform.go Outdated
Comment thread resources/resource_transformers/js/build.go
@bep
bep force-pushed the feat/cssbuild-artifacts-15173 branch from ebbaf33 to 477e636 Compare August 8, 2026 16:31
Artifacts are the additional output files published as part of the build:
source maps and files emitted by ESBuild's file loader (e.g. fonts). Each
artifact provides Permalink, RelPermalink and MediaType, so e.g. font
preload links can be constructed in templates.

Also add media type definitions for source maps (application/source-map),
font/woff and font/woff2.

Fixes gohugoio#15173

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bep
bep force-pushed the feat/cssbuild-artifacts-15173 branch from 477e636 to 2d6bd6e Compare August 8, 2026 16:53
@bep
bep merged commit 44da086 into gohugoio:master Aug 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants