sapper-template icon indicating copy to clipboard operation
sapper-template copied to clipboard

Emit css in modern build only

Open saylerb opened this issue 5 years ago • 5 comments

Currently the template rollup config emits CSS twice if you are running build with the --legacy flag. This is resulting in duplicate css getting served to legacy browsers like IE.

This change changes the config to only emit css on the first pass.

saylerb avatar Sep 30 '20 18:09 saylerb

@saylerb is this the right fix? I don't fully understand what emitCss does as I have proven to myself in the last few days, but if you don't emit css, what happens to it? Does it just end up written to the browser as part of the javascript? Or does it literally leave out css?

The docs don't make it any clearer for me.

antony avatar Oct 01 '20 08:10 antony

I've just tested this, and yeah, for the legacy build, this makes the CSS appear inline in the JS, which isn't what we want either.

Conduitry avatar Oct 01 '20 17:10 Conduitry

@antony I have to admit I don't fully understand the emitCSS. But It appeared to me with it set to true, additional css files were getting written to the client/legacy/ folder that matched that in the client/. I can do a bit more digging into it

@Conduitry I can take a second pass. I don't think I saw the additional inline css.

saylerb avatar Oct 02 '20 00:10 saylerb

I looked into this briefly, I think there may be a bug inject_scripts in how it is resolving the paths. If the CSS handling is being re-written, should I hold off on looking more deeply into this until 0.29 comes out?

saylerb avatar Oct 10 '20 22:10 saylerb

There are not going to be any major changes to the CSS handling, so if there are any bugs that are there now they would continue to be present

benmccann avatar Oct 10 '20 23:10 benmccann