-
-
Notifications
You must be signed in to change notification settings - Fork 433
Sapper generates duplicate CSS files #1076
Comments
I have tried to reproduce this with sapper-template-webpack using |
Not sure if this is related but we are evaluating Sapper and ran into an issue where an API call that we were making from I understand there is a transpilation step to make the svelte goodness happen, but this is a bit disconcerting and smells of a bit too much magic going on under the hood if I can´t be sure if what I am running is current or some errant version from the past Why are different versions being kept around? Even if we are expected to clear the build directory ourselves in a build step, it still seems strange that anything other than the latest build would even be considered for actually running by the sapper mechanism. "sapper": "^0.27.0" |
I have generated the webpack project even the webpack project have the same issue |
@Sidd27 Have you checked to see if the CSS files are exactly the same? When I tried to reproduce with WebPack, the CSS file contents was not the same. |
We confirmed this particular issue is only with Rollup. The issue is in this repo, not rollup-plugin-svelte, but it is code that only runs when bundling with Rollup, not Webpack. If you'd like to try the fix, we published a fork that includes the fix in the linked PR as @mapgrid/sapper which we are using in production until the PR is merged. @Conduitry our CSS bundle size went from 600kb to 300kb (on a large production site) with this fix. |
@mapgrid Thanks a lot for the PR! |
@s0kil The issue also persist in webpack |
@Sidd27 I can reproduce the issue with CSS being inlined. |
On a unrelated note: Whilst inspecting the output of HTML generated by Sapper, there are some missing closing tags: index.html
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<meta content="width=device-width,initial-scale=1" name=viewport>
<meta content=#333333 name=theme-color>
<base href=/ >
<link href=global.css rel=stylesheet>
<link href=manifest.json rel=manifest crossorigin=use-credentials>
<link href=favicon.png rel=icon type=image/png>
<style>main.svelte-1uhnsl8{position:relative;max-width:56em;background-color:#fff;padding:2em;margin:0 auto;box-sizing:border-box}nav.svelte-1dbd5up{border-bottom:1px solid rgba(255,62,0,.1);font-weight:300;padding:0 1em}ul.svelte-1dbd5up{margin:0;padding:0}ul.svelte-1dbd5up::after{content:'';display:block;clear:both}li.svelte-1dbd5up{display:block;float:left}[aria-current].svelte-1dbd5up{position:relative;display:inline-block}[aria-current].svelte-1dbd5up::after{position:absolute;content:'';width:calc(100% - 1em);height:2px;background-color:#ff3e00;display:block;bottom:-1px}a.svelte-1dbd5up{text-decoration:none;padding:1em .5em;display:block}figure.svelte-1kk9opm,h1.svelte-1kk9opm,p.svelte-1kk9opm{text-align:center;margin:0 auto}h1.svelte-1kk9opm{font-size:2.8em;text-transform:uppercase;font-weight:700;margin:0 0 .5em 0}figure.svelte-1kk9opm{margin:0 0 1em 0}img.svelte-1kk9opm{width:100%;max-width:400px;margin:0 0 1em 0}p.svelte-1kk9opm{margin:1em auto}@media(min-width:480px){h1.svelte-1kk9opm{font-size:4em}}</style>
<noscript id=sapper-head-start></noscript>
<title>Sapper project template</title>
<noscript id=sapper-head-end></noscript>
<link href=/client/c30f67d5f444719868d3/main.js rel=preload as=script>
<link href=/client/c30f67d5f444719868d3/index.3.js rel=preload as=script>
</head>
<body>
<div id=sapper>
<nav class=svelte-1dbd5up>
<ul class=svelte-1dbd5up>
<li class=svelte-1dbd5up>
<a class=svelte-1dbd5up href=. aria-current=page>home</a>
</li>
<li class=svelte-1dbd5up>
<a class=svelte-1dbd5up href=about>about</a>
</li>
<li class=svelte-1dbd5up>
<a class=svelte-1dbd5up href=blog rel=prefetch>blog</a>
</li>
</ul>
</nav>
<main class=svelte-1uhnsl8>
<h1 class=svelte-1kk9opm>Great success!</h1>
<figure class=svelte-1kk9opm>
<img alt=Borat class=svelte-1kk9opm src=great-success.png>
<figcaption>HIGH FIVE!</figcaption>
</figure>
<p class=svelte-1kk9opm>
<strong>Try editing this file (src/routes/index.svelte) to test live reloading.</strong>
</p>
</main>
</div>
<script>__SAPPER__={baseUrl:"",preloaded:[void 0,{}]};if('serviceWorker' in navigator)navigator.serviceWorker.register('/service-worker.js');</script>
<script src=/client/c30f67d5f444719868d3/main.js></script> In this snippet, |
Yes, that is correct, the duplicate inline styles should be a separate issue (maybe stemming from The lack of This issue is specifically about duplicate, physical |
@Sidd27 Please create a new issue with the problems you outlined. |
When building or exporting a Sapper application, it generates
client.hash.css
andmain.hash.css
both files are the same.Is this
__sapper__/build/build.json
themain.1877335015.css
andclient.c810e122.css
files are the same.This behavior is reproducible in the sapper-template-rollup.
Sapper: 0.27.9
Svelte: 3.18.1
Ubuntu: 19.10
The text was updated successfully, but these errors were encountered: