Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

%sapper.scripts% can contain non-JS files #154

Open
Rich-Harris opened this issue Mar 4, 2018 · 2 comments
Open

%sapper.scripts% can contain non-JS files #154

Rich-Harris opened this issue Mar 4, 2018 · 2 comments
Labels

Comments

@Rich-Harris
Copy link
Member

Moving this from #116 (comment) since that issue is closed by #153. If webpack emits non-JS assets for a route, Sapper will still generate a <script> tag for them:

<script src='/client/123xyz/main.css'></script>
@maxmilton
Copy link

I'm currently running into this, getting things like <script src=/client/fbd4e5d87f8d7dec1966/main.0.css> injected into the page when attempting to set up mini-css-extract-plugin to generate a global css file.

Expanding upon this, I also need to inject that CSS file into the head as a <link>. I'm using sapper-template as the base, which currently has no pre-defined CSS processing beyond what svelte provides. I've openned an issue about it there: sveltejs/sapper-template#59

@silentworks
Copy link
Contributor

@Rich-Harris if we change https://github.com/sveltejs/sapper/blob/master/src/middleware.ts#L483 to .filter(function (file) { return file.match(/\.js$/); }), wouldn't this fix the inclusion of the css files in a script tag?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants