-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: improve css render performance #1476
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -16,7 +16,41 @@ useSeoMeta({ | |||||||||||||||||||||||||
twitterImage: joinURL(site.url, '/new-social.jpg') | ||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||
</script> | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
<style> | ||||||||||||||||||||||||||
.content-visibility-auto { | ||||||||||||||||||||||||||
content-visibility: auto; | ||||||||||||||||||||||||||
contain:layout; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
.contain-intrinsic-size-200 { | ||||||||||||||||||||||||||
contain-intrinsic-size: 200px; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
.contain-intrinsic-size-500 { | ||||||||||||||||||||||||||
contain-intrinsic-size: 200px; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
.contain-intrinsic-size-800 { | ||||||||||||||||||||||||||
contain-intrinsic-size: 200px; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
Comment on lines
+27
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that correct ?
Suggested change
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
.contain-layout{ | ||||||||||||||||||||||||||
contain:layout; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
.contain-content{ | ||||||||||||||||||||||||||
contain:content; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
.contain-strict{ | ||||||||||||||||||||||||||
contain:strict; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
img, svg, span[class^="i-ph"] { | ||||||||||||||||||||||||||
contain:content; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
span[class^="i-ph"] { | ||||||||||||||||||||||||||
content-visibility: auto; | ||||||||||||||||||||||||||
contain-intrinsic-size: 20px; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
</style> | ||||||||||||||||||||||||||
<template> | ||||||||||||||||||||||||||
<div v-if="page"> | ||||||||||||||||||||||||||
<ULandingHero :ui="{ base: 'relative z-[1]' }" class="dark:bg-gradient-to-b from-gray-950 to-gray-900"> | ||||||||||||||||||||||||||
|
@@ -77,7 +111,7 @@ useSeoMeta({ | |||||||||||||||||||||||||
v-for="(section, index) of page.sections" | ||||||||||||||||||||||||||
:key="index" | ||||||||||||||||||||||||||
:slot="section.slot" | ||||||||||||||||||||||||||
:class="section.class" | ||||||||||||||||||||||||||
:class="section.class.toString() + ' content-visibility contain-intrinsic-size-500'" | ||||||||||||||||||||||||||
BioPhoton marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
:align="section.align" | ||||||||||||||||||||||||||
:links="section.links" | ||||||||||||||||||||||||||
> | ||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,29 @@ defineShortcuts({ | |
|
||
const { copy } = useCopyToClipboard() | ||
</script> | ||
<style> | ||
#module-categories { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose these could be moved to tailwind-equivalents There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you give me more info what this means I'll do it right now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually global classes are added as a plugin in Tailwind. As a matter of fact, the docs feature an example using But, bear in mind that I'm an outsider, don't take this comment as actual advice of what to do since the Nuxt team could have a different answer. 👍🏽😉🤗 |
||
contain: content; | ||
content-visibility: auto; | ||
height: 643px; | ||
contain-intrinsic-size: 643px; | ||
} | ||
|
||
.module-card { | ||
contain: content; | ||
content-visibility: auto; | ||
} | ||
|
||
@media screen and (max-width: 992px) { | ||
.module-card { | ||
contain-intrinsic-size: auto 200px; | ||
} | ||
} | ||
|
||
.module-card { | ||
contain-intrinsic-size: auto 238px; | ||
} | ||
</style> | ||
|
||
<template> | ||
<UContainer> | ||
|
@@ -53,22 +76,22 @@ const { copy } = useCopyToClipboard() | |
<UPageGrid :ui="{ wrapper: 'grid-cols-2 sm:grid-cols-2 xl:grid-cols-2 gap-4' }"> | ||
<UPageCard to="https://image.nuxt.com/?utm_source=nuxt_website&utm_medium=modules" target="_blank" description="Plug-and-play image optimization."> | ||
<template #title> | ||
Nuxt Image <UIcon name="i-ph-medal-duotone" class="h-4 w-4 text-primary pointer-events-none" /> | ||
Nuxt Image <UIcon loading="lazy" name="i-ph-medal-duotone" class="h-4 w-4 text-primary pointer-events-none" /> | ||
</template> | ||
</UPageCard> | ||
<UPageCard to="https://content.nuxt.com/?utm_source=nuxt_website&utm_medium=modules" target="_blank" title="Nuxt Content" description="Git-based CMS with Markdown support."> | ||
<template #title> | ||
Nuxt Content <UIcon name="i-ph-medal-duotone" class="h-4 w-4 text-primary pointer-events-none" /> | ||
Nuxt Content <UIcon loading="lazy" name="i-ph-medal-duotone" class="h-4 w-4 text-primary pointer-events-none" /> | ||
</template> | ||
</UPageCard> | ||
<UPageCard to="https://devtools.nuxt.com/?utm_source=nuxt_website&utm_medium=modules" target="_blank" description="Visual tools that help you to know your app."> | ||
<template #title> | ||
Nuxt DevTools <UIcon name="i-ph-medal-duotone" class="h-4 w-4 text-primary pointer-events-none" /> | ||
Nuxt DevTools <UIcon loading="lazy" name="i-ph-medal-duotone" class="h-4 w-4 text-primary pointer-events-none" /> | ||
</template> | ||
</UPageCard> | ||
<UPageCard to="https://ui.nuxt.com/?utm_source=nuxt_website&utm_medium=modules" target="_blank" description="Fully styled and customizable components."> | ||
<template #title> | ||
Nuxt UI <UIcon name="i-ph-medal-duotone" class="h-4 w-4 text-primary pointer-events-none" /> | ||
Nuxt UI <UIcon loading="lazy" name="i-ph-medal-duotone" class="h-4 w-4 text-primary pointer-events-none" /> | ||
</template> | ||
</UPageCard> | ||
</UPageGrid> | ||
|
@@ -77,7 +100,7 @@ const { copy } = useCopyToClipboard() | |
|
||
<UPage id="smooth" class="pt-20 -mt-20"> | ||
<template #left> | ||
<UAside> | ||
<UAside id="module-categories"> | ||
<UNavigationTree :links="[{ label: 'Categories', disabled: true, children: categories }]" /> | ||
|
||
<template #bottom> | ||
|
@@ -137,11 +160,13 @@ const { copy } = useCopyToClipboard() | |
:key="index" | ||
:to="`/modules/${module.name}`" | ||
:title="module.name" | ||
class="flex flex-col" | ||
class="module-card flex flex-col" | ||
:ui="{ body: { base: 'flex-1' }, footer: { base: 'bg-gray-100/50 dark:bg-gray-800/50' } }" | ||
> | ||
<template #icon> | ||
<UAvatar :src="moduleImage(module.icon)" :icon="moduleIcon(module.category)" :alt="module.name" size="lg" :ui="{ rounded: 'rounded-lg' }" /> | ||
<UAvatar | ||
loading="lazy" | ||
:src="moduleImage(module.icon)" :icon="moduleIcon(module.category)" :alt="module.name" size="lg" :ui="{ rounded: 'rounded-lg' }" /> | ||
</template> | ||
|
||
<template #title> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would probably be nice to define these Tailwind utils "globally" 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes! where can i put them??
I'm a beginner vue coder just so u be humble with my ugly code :D