You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.
Currently CSS processing is rather rudimentary; static global CSS in the assets dir and svelte component CSS included in JS bundles. That's all well and good for a demo or PoC but the reality is production sites need more flexibility, repeatability, and automation.
Since we're using webpack for bundling, it should also be set up to handle generating CSS file/s. A link to the file/s should also be injected into the page template.
Using css-loader + style-loader/mini-css-extract-plugin is probably all we need for most projects to get started. This is easy to set up but now we also need to add a <link rel=stylesheet> to the head which doesn't automatically happen. In other webpack projects I would use html-webpack-plugin but that seems like overkill when sapper is already handling template.html.
So, what we need for this is:
Change webpack client config: sevelte to pass CSS to webpack + handle CSS via webpack loaders.
Provide a way to inject CSS file/s via a <link>.
For reference, here's what I'm using in one of my new projects, which covers 1. It also uses postcss but that's not necessary for sapper-template.
The text was updated successfully, but these errors were encountered:
I am trying out sapper, immediate findglobal.css is static and not minified after build. A workaround would be having separate build step for it, but is there a more elegant way?
Experienced similar situation when I was importing variables into global.css. For ease I ended up creating a wrapper component and putting all the contents of global.css into it which all other components are used inside of.
Currently CSS processing is rather rudimentary; static global CSS in the assets dir and svelte component CSS included in JS bundles. That's all well and good for a demo or PoC but the reality is production sites need more flexibility, repeatability, and automation.
Since we're using webpack for bundling, it should also be set up to handle generating CSS file/s. A link to the file/s should also be injected into the page template.
Using
css-loader
+style-loader
/mini-css-extract-plugin
is probably all we need for most projects to get started. This is easy to set up but now we also need to add a<link rel=stylesheet>
to the head which doesn't automatically happen. In other webpack projects I would usehtml-webpack-plugin
but that seems like overkill when sapper is already handlingtemplate.html
.So, what we need for this is:
<link>
.For reference, here's what I'm using in one of my new projects, which covers 1. It also uses postcss but that's not necessary for sapper-template.
The text was updated successfully, but these errors were encountered: