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

Externalise scripts and styles when prerendering #3555

Open
Tracked by #3499
Rich-Harris opened this issue Jan 26, 2022 · 1 comment
Open
Tracked by #3499

Externalise scripts and styles when prerendering #3555

Rich-Harris opened this issue Jan 26, 2022 · 1 comment
Labels
feature / enhancement New feature or request
Milestone

Comments

@Rich-Harris
Copy link
Member

Describe the problem

In certain situations it makes sense to externalise inline scripts and styles for CSP purposes (e.g. when building Chrome extensions).

Describe the proposed solution

This only really applies to prerendered pages (there's basically no good way to externalise a dynamically rendered script), so I propose the following interface:

// svelte.config.js
export default {
  kit: {
    prerender: {
      externalise: true
    }
  }
};

This would override the inlineStyleThreshold option. (If externalise isn't descriptive enough, we can bikeshed this.)

This would write out an inline script to the filesystem for each prerendered page, under the appDir (so the script can be cached immutably).

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

@bogacg
Copy link

bogacg commented Apr 17, 2023

Any hope for this one in the horizon?
I love extension development, I love SvelteKit...I'm sure there are many like myself.

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

3 participants