sveltejs / sveltejs/kit

Make `%sveltekit.assets%` placeholder available to `src/error.html` page

Open
#12,712 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

It is not uncommon to share global style sheets for various pages of a site. SvelteKit provides %sveltekit.assets% placeholder to src/app.html but not to src/error.html. IMHO error pages should also share the same theme as the rest of the application/site, and so it comes as a surprise to discover that I cannot access the global stylesheets using %sveltekit.assets%. I am failing to see the reason as to why it is not made available in this context.

Describe the proposed solution

I would like to see %sveltekit.assets% made available to src/error.html page as well.

My first thought was to figure out where these placeholders are replaced and fix it. But thought I should ask if there is a reason for the omision.

The fix I have feels out of place but it is to simply use the src relative absolute path. Which implies that if I change the location of my assets folder, then I have to remember to go fix my error.html page, which is not ideal.

Alternatives considered

Get into the codebase and fix it!

Importance

would make my life easier

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare how %sveltekit.assets% is handled for src/app.html and src/error.html, then inspect the placeholder replacement path described in the issue. The change is done when the placeholder resolves to the configured assets path in src/error.html as it does in src/app.html; check the relevant existing tests if the replacement path identifies them.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.