svelte-material-ui
svelte-material-ui copied to clipboard
Stylesheets imports issue with svelteKit
Hello, this is the first time i am using svelte, and the first time i contribute to any project in Github, so if i'm wrong, please let me know.
I tried using @smui components using svelteKit, but had issues with importing stylesheets, specifically this one in the readme, when importing smui.css
.
It always failed to load, and the issue is related to how svelteKit builds the project. I have read it before online but forgot the link TBH.
Anyway the fix for this is replacing this code :
<link rel="stylesheet" href="/smui.css" />
with this code
<link rel="stylesheet" href="%sveltekit.assets%/smui.css" />
Please let me know what you think. If this is correct, i'll gladly submit a PR for it.
Thank you for your time, and for the lovely SMUI library. For me, coming from a React Background, losing Material-UI was devastating to me, but then i found SMUI ❤️
Hello, this is correct but it is assuming you have already prepared your CSS with smui-theme
. Please visit https://sveltematerialui.com/THEMING.md for more information about theming SMUI.
SMUI takes the approach that it does to make it very easily to customize your SMUI theme with SCSS, and to perform dead code elimination at build time by only including the CSS for the SMUI components present in your project.
From my experience with using SMUI with the latest versions of SvelteKit, usage of %sveltekit.assets%
has never been a requirement. It's generally a good idea to have smui-theme
output to the static
folder. Either approach is valid, it's up to your preference.