sveltejs / sveltejs/kit

Support multiple static asset dirs by allowing string arrays for `config.kit.files.assets`

Open
#5,115 4 comments 10 reactions 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

I'd like to get static assets from multiple locations. In this example the SvelteKit site is inside the site/ directory as part of a bigger project and I'd like to use static assets from assets/ and site/static/.

.
├── assets
│   ├── ...
└── site
    ├── src
    ├── static
    └── ...
Describe the proposed solution

config.kit.files.assets could support arrays:

// svelte.config.jg

export default {
  kit: {
    adapter: adapter(),

    files: {
      assets:[ `../assets`, `./static` ],
    },
  },
}

This currently raises

config.kit.files.assets should be a string, if specified

Alternatives considered

Create an alias of assets/ in site/static/. It works but feels hacky.

Importance

nice to have

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

Start with the config.kit.files.assets validation and the static asset handling described in the issue. Check the existing configuration and asset-related tests, then verify that multiple asset directories are accepted and served without breaking the current single-directory behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.