Sapper: Inline main.js

Created on 18 Dec 2017  路  3Comments  路  Source: sveltejs/sapper

It's small enough that maybe it doesn't make sense to make an extra request?

internals stale

Most helpful comment

Also: until recently critical CSS was inlined; as part of the 0.19 work towards extracting CSS, that's no longer the case. We should consider whether critical CSS should be inlined, and if so in what circumstances.

All 3 comments

Also: until recently critical CSS was inlined; as part of the 0.19 work towards extracting CSS, that's no longer the case. We should consider whether critical CSS should be inlined, and if so in what circumstances.

Inlining of CSS, JS, SVG looks like must-have trick in performant mobile web scenarios.
To the degree that there are pretty mature HTTP server plugins to do inlining :D

Setting emitCss: false works like a charm on component level, but inlining of global critical css, sounds like a common task that is not addressed, CSS Reset, Grid, url-encoded-fonts, url-encoded-icons, also many of us rely on CSS frameworks.

Also, mobile (especially pre-HTTP/2) is quite sensitive to quantity of requests, and having one additional HTTP request per component doesn't sounds like a good idea, as slow connections do suffer from having to deal with additional requests.

Would it be good idea to add something like%sapper.inline_global_critical_css% ?

https://github.com/sveltejs/sapper/pull/1269 may somewhat obviate the need for this. If you use a CDN, then the preload header will probably cause the CSS to be server pushed to you, which is probably better than inline because it can be cached.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matt3224 picture matt3224  路  4Comments

milosdjakovic picture milosdjakovic  路  3Comments

nolanlawson picture nolanlawson  路  4Comments

BMorearty picture BMorearty  路  3Comments

Rich-Harris picture Rich-Harris  路  3Comments