diff --git a/content/collections/tags/spaceless.md b/content/collections/tags/spaceless.md new file mode 100644 index 000000000..154ec9de5 --- /dev/null +++ b/content/collections/tags/spaceless.md @@ -0,0 +1,45 @@ +--- +title: Spaceless +id: 770a2167-bdb1-4c37-944e-af21a8a9343d +description: 'Strips the invisible gaps between HTML tags that your formatter keeps sneaking into your templates.' +intro: 'You formatted your Antlers nicely, and now there''s a mystery gap between two buttons that no amount of margin-hunting will explain. The `spaceless` tag hunts down whitespace between tags and removes it, without touching your actual words.' +--- +## Overview + +Prettier and friends love breaking markup onto new lines, one tag per line, neatly indented. Browsers turn that line break into a visible gap between inline elements. `spaceless` strips whitespace-only gaps between tags in its rendered content, so your formatter can keep breaking lines without leaving fingerprints in the DOM. + +::tabs +::tab antlers +```antlers +{{ spaceless }} + +{{ /spaceless }} +``` +::tab blade +```blade + + + +``` +:: + +```html + +``` + +## What it does + +- Removes whitespace that sits directly between two tags (`> <` becomes `><`). +- Collapses whitespace within text down to a single space rather than deleting it, so `Hello\nWorld` stays `Hello World`. +- Leaves whitespace around an inline tag inside prose alone, so a link mid-sentence doesn't glue to its neighboring words. +- Leaves `