on-demand css (unocss) #13385
Replies: 2 comments 3 replies
-
@rstoenescu @hawkeye64 I'm not familiar with Quasar implementation but wouldn't be a good compromise to allow users to disable utility classes so it's possible to use UnoCSS with a Quasar preset without introducing breaking changes? The Quasar preset could be provided by the community if the Quasar team doesn't want to maintain it. It could be something similar to what Vuetify provides:
Or could even be more specific: // /src/css/quasar.variables.sass
$utilities: (
border: false,
colors: false,
grid: false,
interaction: false,
orientation: false,
positioning: false,
scrolling: false,
sizing: false,
shadow: false,
spacing: false,
typography: false,
visibility: false,
); |
Beta Was this translation helpful? Give feedback.
-
Huge plus one for this. The problemI was REALLY frustrated by the poor performance of my project during development with Vite. The devserver started really fast, but HMR took 4s on average, making it completely uusable. My machine was even getting out of memory due to the amount of files being watched. So, I paused and started to investigate and found 2 main performance killers. One of them was Tailwind. I replaced it with UnoCSS then. The second one was So, every time I reloaded a page, the JavaScript booted, then it started to load the SASS file, then then get the CSS compiled and then delivering it to the client. So, this would make sense if Vite was picking up only the necessary CSS bits. But when I opened the SASS file, I realized that this is bundling TONS of unused classes like WorkaroundSo, for now, I'm removing the import of the SASS file from mais <!-- I have a build step that copy the stylesheet from the node_modules to my public directory -->
<link rel="stylesheet" href="http://localhost/quasar.prod.css" />
<!-- Customize branding colors -->
<style>
:root {
--q-primary: #8b5cf6;
--q-secondary: #86198f;
--q-accent: #d946ef;
--q-dark: #1e293b;
--q-dark-page: #0f172a;
--q-positive: #22c55e;
--q-negative: #ef4444;
--q-info: #3b82f6;
--q-warning: #fbbf24;
}
</style> I'm still left with the problem of unused code at the end, but at least the dev experience is enhanced until we can get an update that prevents all of this. |
Beta Was this translation helpful? Give feedback.
-
Don't we want to use unocss for on-demand css generation?
For now we have to include whole styles ~100kB of css classes for all components, while we use 20-30%.
Using PurgeCSS for cleaning unused classes seems to be unreal to clean it correctly.
But
unocss
do its work quite good, check the sample config for itBeta Was this translation helpful? Give feedback.
All reactions