Framework-agnostic CSS utilities and single-file Liquid 'bricks' for modern web development.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@anydigital/bricks@1/dist/bricks.css" />npm install @anydigital/bricksThen import in your CSS:
@import "@anydigital/bricks";Prevents horizontal overflow and scrolling on the entire page:
html,
body {
overflow-x: clip;
}This is automatically applied when you include the stylesheet.
Ensures the body element takes at least the full height of the viewport using dynamic viewport height for better mobile support:
body {
min-height: 100dvh;
}This is automatically applied when you include the stylesheet.
Improves text rendering and readability:
body {
hyphens: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}- Automatic hyphenation for better text flow
- Font smoothing for cleaner text rendering across browsers
- Hyphenation is disabled for links and tables to prevent awkward breaks
This is automatically applied when you include the stylesheet.
The .prose class provides enhanced typography for article content and long-form text with container-like behavior:
Container:
- Full width
- Centered with automatic inline margins
Typography Helpers:
subelements: styled for multi-line subtitles with top vertical alignment,1.1line height, lighter weight (300), and displayed asinline-blockwith100%width to prevent underline decoration inside links
Links:
- Custom underline offset (
0.1em) and thickness (1pxdefault,2pxon hover) - Anchor links (starting with
#) have no text decoration - Icon helper:
ielements inside links are displayed asinline-blockwith normal font style to prevent underline decoration, with1emheight and0.25emright margin. Nestedimgelements are styled with100%height, no margin, and positioned0.15emfrom the bottom for proper alignment
Headings:
h1elements have a0.5embottom marginh1 subelements get reduced font size (50%)- Support for heading anchors via
.header-anchorclass (displayed on hover to the left of the heading)
Tables:
- Tables within
.breakoutcontainers are automatically styled for full-bleed display and horizontal scrolling - Table cells (
thandtd) have padding of1rem 2rem 1rem 0(extra space on the right for better horizontal scroll on mobile) andtopvertical alignment - Table headers (
th) havebottomvertical alignment - Workaround for widening columns using hidden
hrelements (width:12ch, with zero margin and hidden visibility) - Support for headings in Markdown tables using
bigelements (styled as bold) - Images in table cells have no top margin and
1embottom margin
Blockquotes:
- Lighter font weight (
300) - Adjacent
figcaptionelements (using+ figcaptionselector) are styled with italic text, right alignment, lighter weight (300), negative top margin (-1em), and an em dash prefix (β) with0.25emright margin
Code Blocks:
- Code blocks with
data-captionattribute display the caption above the code block (styled with 50% opacity, italic, and1.5embottom margin)
Includes specialized styling for Prism.js, specifically focusing on treeview components:
- Custom styling for
.token.treeview-part - Reduced opacity for entry lines (25%) and names (50%) to create a hierarchical visual effect
- Entry lines have a fixed width of
2.5em - Last-child entry names have no
::beforepseudo-element - Supports complex file tree visualizations out of the box
The .invert class can be used to invert the scrollbar colors, which is particularly useful for dark themes or specific UI components:
.invert {
::-webkit-scrollbar {
filter: invert(1) !important;
}
}The .whitespace-nowrap class can be applied to links to prevent them from wrapping, which is particularly useful when links contain icons that should stay with the text:
<a href="#" class="whitespace-nowrap">
<i><img src="icon.svg" alt="" /></i>Stay with me
</a>This ensures the icon and the text stay together on the same line. If you need nested elements to allow wrapping, they are automatically reset to white-space: normal.
Usage:
<article class="prose">
<h1>Article Title</h1>
<p>Your content here...</p>
</article>This is automatically included when you import the stylesheet.
Sets up a flexible column layout structure:
body {
display: flex;
flex-direction: column;
}
body > main {
flex-grow: 1;
}The body becomes a flex container with column direction, and main elements automatically grow to fill available space. This is useful for creating sticky footers and full-height layouts.
This is automatically applied when you include the stylesheet.
Includes breakout-css utilities for breaking out images and figures beyond their container width. Use the .breakout class to allow elements to extend beyond their parent container:
<div class="breakout">
<img src="image.jpg" alt="Description" />
</div>The breakout container has 10% inline padding and a max-width of calc(10% + 65ch + 10%). The breakout utilities support images, pictures, figures, canvas, audio, video, tables, pre, iframe, and other media elements. Tables inside .breakout are specifically enhanced for horizontal scrolling and full-bleed mobile display. This is automatically included when you import the stylesheet.
The package includes reusable Liquid templates in the bricks/ directory. These are useful for common web development patterns.
Base HTML templates that provide the essential document structure with built-in support for modern web best practices. Split into begin and end files to wrap around your content.
Features:
- HTML5 DOCTYPE with language attribute (defaults to
en, configurable viasite.lang) - UTF-8 charset and comprehensive viewport meta tag with
viewport-fit=coverfor notched devices - Dynamic title generation with site title suffix (title is stripped of HTML tags and separated with
|) - Favicon link (to
/favicon.ico) - Automatic stylesheet linking from
site.stylesarray - Inline styles from
site.inline_stylesarray (joined with newlines in a<style>tag) - Automatic script loading from
site.scriptsarray (withdeferattribute) - Inline module scripts from
site.inline_scriptsarray (joined with newlines in a<script type="module">tag) - Custom header content via
content_for_header - Google Tag Manager integration (automatically rendered via
_gtm.liquidtemplate for both<head>and<body>)
Usage:
{% render 'bricks/__html-begin', site: site, title: title, content_for_header: content_for_header %}
<!-- Your page content -->
{% render 'bricks/__html-end' %}Note: Google Tag Manager is automatically included in both <head> and <body> (via the _gtm.liquid template) when site.prod and site.gtm_id are set.
Variables:
title- Page title (optional, will be stripped of HTML tags)site.title- Site title for the title suffixsite.lang- Language code (optional, defaults to'en')site.styles- Array of stylesheet URLs (optional)site.inline_styles- Array of inline CSS strings (optional)site.scripts- Array of script URLs (optional)site.inline_scripts- Array of inline JavaScript strings (optional)content_for_header- Custom HTML for the head section (optional)site.gtm_id- Google Tag Manager ID (optional)site.prod- Boolean flag for production environment (optional)
A navigation template that renders a list of navigation links with proper accessibility attributes.
Parameters:
nav_pages- Array of navigation page objects withurlandtitlepropertiescurrent_url- The URL of the current page (used to setaria-current="page")
Usage:
{% render 'bricks/_nav', nav_pages: navPages, current_url: page.url %}Example:
{% assign navPages = site.pages | where: "nav", true %}
{% render 'bricks/_nav', nav_pages: navPages, current_url: page.url %}Output:
<nav>
<a href="/">Home</a>
<a href="/about" aria-current="page">About</a>
<a href="/contact">Contact</a>
</nav>Compatibility: Compatible with Eleventy Navigation plugin.
A template for embedding Google Tag Manager scripts in your pages.
Parameters:
site.gtm_id- Your Google Tag Manager container ID (e.g.,GTM-XXXXXXX)site.prod- Boolean flag to enable GTM only in productionfor_body- Boolean flag (default:false). Whenfalse, renders the script tag for the<head>. Whentrue, renders the noscript fallback for the<body>.
Note: This template is automatically included when using __html-begin.liquid and __html-end.liquid. You only need to manually render it if you're not using those base templates.
Manual Usage:
In your base template's <head>:
{% render 'bricks/_gtm', site: site %}In your base template's <body> (right after the opening tag):
{% render 'bricks/_gtm', site: site, for_body: true %}Example (Manual Integration):
<!DOCTYPE html>
<html>
<head>
{% render 'bricks/_gtm', site: site %}
</head>
<body>
{% render 'bricks/_gtm', site: site, for_body: true %}
<!-- Your content -->
</body>
</html>Rendering Logic: The GTM script is only rendered when both site.prod is true and site.gtm_id is set. The template uses a capture block to strip whitespace from the output.
MIT