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

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

Open
janosh opened this issue May 30, 2022 · 2 comments
Labels
feature / enhancement New feature or request
Milestone

Comments

@janosh
Copy link
Contributor

janosh commented May 30, 2022

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

@janosh janosh changed the title Support multiple static asset dirs through by allowing string arrays for config.kit.files.assets Support multiple static asset dirs by allowing string arrays for config.kit.files.assets May 30, 2022
@jochemvogel
Copy link
Contributor

Would love to see this. I'm trying to exclude the static/img folder from the { files } in my service worker, because of the size.

I now do it with a workaround, but feels not very natural. Is there another solution for this problem?

Workaround: const cachedFiles = files.filter(file => !file.startsWith('/img');

@alexanderl19
Copy link

Would also love to see this. It looks like vite only supports one public folder, so this might be a vite limitation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature / enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants