Add Data.Artifacts to css.Build and js.Build - #15175
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.Artifactand populateResourceTransformationCtx.Data["Artifacts"]during ESBuild processing. - Add integration tests validating artifact presence/links for both
css.Buildandjs.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.
bep
force-pushed
the
feat/cssbuild-artifacts-15173
branch
from
August 8, 2026 16:31
ebbaf33 to
477e636
Compare
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
force-pushed
the
feat/cssbuild-artifacts-15173
branch
from
August 8, 2026 16:53
477e636 to
2d6bd6e
Compare
16 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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