Debugging
A skeleton that doesn't match its content makes the page jump when the content arrives. The debug overlay finds those places. It outlines every skeleton in blue while it loads and says where its shape came from. When the content arrives, the outline turns green if nothing moved, or red with how many pixels it moved.
GET /posts/3loadingTurning it on
Add ?skeleton-debug to the URL, or turn it on for the whole app:
export default defineNuxtConfig({
boneprint: { debug: true },
})
app.use(boneprint, { debug: true })
To outline one part of the page, put data-skeleton-debug on any element around it.
Where a shape comes from
| Label | Source |
|---|---|
memory | the shape remembered from an earlier load |
data | the data already on screen, with :loading over it |
sample | your sample |
slot | the slot as it is, without data or of |
generic lines | nothing to measure: pass a sample or an id |
Seeing what was measured
Put data-skeleton-xray on any element around a skeleton. The hidden markup then shows through the bones in red, so you can check that the bars sit on the real lines.
<div data-skeleton-debug data-skeleton-xray>
<Skeleton :of="post" :sample />
</div>
When the page moves
Most often the sample is shorter or longer than the real data, so give it text of typical length. If an image moves when it loads, it had no size to begin with: give it a width and height, or an aspect-ratio.