@anydigital/blades 0.27.0-alpha.16 → 0.27.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -278
- package/_includes/blades/gtm.liquid +16 -0
- package/_includes/blades/gtm.njk +20 -0
- package/_includes/blades/html.liquid +4 -7
- package/_includes/blades/html.njk +2 -5
- package/_includes/blades/links.liquid +16 -5
- package/_includes/blades/sitemap.xml.njk +12 -0
- package/assets/blades.css +317 -167
- package/assets/blades.theme.css +25 -9
- package/assets/breakout.css +14 -3
- package/assets/responsive-table.css +15 -6
- package/blades.gemspec +1 -1
- package/package.json +3 -4
- package/src/_code.css +45 -0
- package/src/_layout.css +57 -0
- package/src/_link.css +42 -0
- package/src/_table.css +28 -18
- package/src/_typography.css +103 -0
- package/src/_unreduce-motion.css +7 -3
- package/src/_utilities.css +34 -0
- package/src/blades.css +6 -9
- package/src/blades.theme.css +26 -0
- package/src/breakout.css +14 -2
- package/src/responsive-table.css +15 -6
- package/src/_classless.css +0 -48
- package/src/_prism.css +0 -14
- package/src/_tricks.css +0 -117
package/README.md
CHANGED
|
@@ -1,331 +1,145 @@
|
|
|
1
|
-
# 🥷 Blades
|
|
1
|
+
# 🥷 Blades
|
|
2
2
|
|
|
3
3
|
<!--section:hero-->
|
|
4
4
|
|
|
5
|
-
<hgroup>Framework-agnostic,<wbr> class-light CSS
|
|
5
|
+
<hgroup>Framework-agnostic,<wbr> class-light CSS⁺ blade kit.</hgroup>
|
|
6
6
|
|
|
7
|
-
<big>Use with Pico, Tailwind, or any other CSS reset/framework.</big>
|
|
7
|
+
<big>Use with Pico, Simple, Tailwind, or any other CSS reset/framework.</big>
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
[](https://github.com/anydigital/blades)
|
|
8
11
|
|
|
9
12
|
<!--section-->
|
|
10
13
|
|
|
11
14
|
Nunjucks/Liquid batteries included (for 11ty/Build Awesome, Jekyll, etc.) 🥷
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
[](https://blades.ninja/)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<!--section:index-->
|
|
21
|
+
|
|
22
|
+
## <sup>Class-light</sup><br> [CSS blades](https://blades.ninja/css/) <br><sub>inspired by Pico.css</sub> <!--{#css}-->
|
|
23
|
+
|
|
24
|
+
<!-- copy-paste of ToC from https://blades.ninja/css/ -->
|
|
25
|
+
<ul class="unlist columns">
|
|
26
|
+
<li><a href="https://blades.ninja/css/#install">Install</a></li>
|
|
27
|
+
<li><a href="https://blades.ninja/css/#layout">Layout</a><ul><li><a href="https://blades.ninja/css/breakout/">🥷 Breakout elements →</a></li>
|
|
28
|
+
<li><a href="https://blades.ninja/css/#landmarks">Landmarks</a></li>
|
|
29
|
+
<li><a href="https://blades.ninja/css/#auto-columns">Auto-columns</a></li>
|
|
30
|
+
<li><a href="https://blades.ninja/css/#jump-to-top">Jump to top</a></li></ul></li>
|
|
31
|
+
<li><a href="https://blades.ninja/css/#content">Content</a><ul><li><a href="https://blades.ninja/css/#heading-anchors">Heading anchors</a></li>
|
|
32
|
+
<li><a href="https://blades.ninja/css/#list-markers">List markers</a></li>
|
|
33
|
+
<li><a href="https://blades.ninja/css/#link-fav-icons">Link [fav]icons</a></li>
|
|
34
|
+
<li><a href="https://blades.ninja/css/#code">Code</a></li></ul></li>
|
|
35
|
+
<li><a href="https://blades.ninja/css/#table">Table</a><ul><li><a href="https://blades.ninja/css/responsive-table/">🥷 Responsive table without wrapper →</a></li>
|
|
36
|
+
<li><a href="https://blades.ninja/css/#horizontal-expanders">Horizontal expanders</a></li>
|
|
37
|
+
<li><a href="https://blades.ninja/css/#borderless-table">Borderless table</a></li></ul></li>
|
|
38
|
+
<li><a href="https://blades.ninja/css/#utilities">Utilities</a><ul><li><a href="https://blades.ninja/css/#auto-dark">Auto-dark</a></li>
|
|
39
|
+
<li><a href="https://blades.ninja/css/#faded">Faded</a></li>
|
|
40
|
+
<li><a href="https://blades.ninja/css/#invert">Invert</a></li>
|
|
41
|
+
<li><a href="https://blades.ninja/css/#unreduce-motion">Unreduce motion</a></li></ul></li>
|
|
42
|
+
<li><a href="https://blades.ninja/css/#theme-optional">Theme (optional)</a></li>
|
|
43
|
+
</ul>
|
|
44
|
+
|
|
45
|
+
<!--section:index,install-css-->
|
|
46
|
+
<details><summary role="button" class="outline"><b>Install CSS blades</b></summary>
|
|
47
|
+
|
|
48
|
+
<mark>Option A.</mark> From CDN:
|
|
49
|
+
|
|
50
|
+
<!--prettier-ignore-->
|
|
21
51
|
```html
|
|
22
|
-
<link href="https://cdn.jsdelivr.net/npm/@anydigital/blades
|
|
52
|
+
<link href="https://cdn.jsdelivr.net/npm/@anydigital/blades@^0.27.0-alpha/assets/blades.min.css" rel="stylesheet" />
|
|
53
|
+
<link href="https://cdn.jsdelivr.net/npm/@anydigital/blades@^0.27.0-alpha/assets/blades.theme.min.css" rel="stylesheet" /><!-- optional -->
|
|
23
54
|
```
|
|
24
55
|
|
|
25
|
-
|
|
56
|
+
<mark>Option B.</mark> Via npm:
|
|
26
57
|
|
|
27
58
|
```sh
|
|
28
59
|
npm install @anydigital/blades
|
|
29
60
|
```
|
|
30
61
|
|
|
31
|
-
|
|
32
|
-
@import "@anydigital/blades";
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
<details><summary>
|
|
36
|
-
|
|
37
|
-
### `_base.css` styles
|
|
38
|
-
|
|
39
|
-
</summary>
|
|
40
|
-
|
|
41
|
-
#### Overflow Control
|
|
42
|
-
|
|
43
|
-
Prevents horizontal overflow and scrolling on the entire page:
|
|
44
|
-
|
|
45
|
-
```css
|
|
46
|
-
html,
|
|
47
|
-
body {
|
|
48
|
-
overflow-x: clip;
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
This is automatically applied when you include the stylesheet.
|
|
53
|
-
|
|
54
|
-
#### Full Viewport Height
|
|
55
|
-
|
|
56
|
-
Ensures the body element takes at least the full height of the viewport using dynamic viewport height for better mobile support:
|
|
57
|
-
|
|
58
|
-
```css
|
|
59
|
-
body {
|
|
60
|
-
min-height: 100dvh;
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
This is automatically applied when you include the stylesheet.
|
|
65
|
-
|
|
66
|
-
#### Flexbox Layout
|
|
67
|
-
|
|
68
|
-
Sets up a flexible column layout structure:
|
|
69
|
-
|
|
70
|
-
```css
|
|
71
|
-
body {
|
|
72
|
-
display: flex;
|
|
73
|
-
flex-direction: column;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
body > main {
|
|
77
|
-
flex-grow: 1;
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
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.
|
|
82
|
-
|
|
83
|
-
This is automatically applied when you include the stylesheet.
|
|
84
|
-
|
|
85
|
-
#### Typography Enhancements
|
|
86
|
-
|
|
87
|
-
Improves text rendering and readability:
|
|
62
|
+
Then import in your .css:
|
|
88
63
|
|
|
89
64
|
```css
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-webkit-font-smoothing: antialiased;
|
|
93
|
-
-moz-osx-font-smoothing: grayscale;
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
- Automatic hyphenation for better text flow
|
|
98
|
-
- Font smoothing for cleaner text rendering across browsers
|
|
99
|
-
- Hyphenation is disabled for links and tables to prevent awkward breaks
|
|
100
|
-
|
|
101
|
-
This is automatically applied when you include the stylesheet.
|
|
102
|
-
|
|
103
|
-
</details>
|
|
104
|
-
|
|
105
|
-
<details><summary>
|
|
106
|
-
|
|
107
|
-
### `_prose.css` Tailwind Typography enhancements
|
|
108
|
-
|
|
109
|
-
</summary>
|
|
110
|
-
|
|
111
|
-
The `.prose` class provides enhanced typography for article content and long-form text with container-like behavior:
|
|
112
|
-
|
|
113
|
-
**Container:**
|
|
114
|
-
|
|
115
|
-
- Full width
|
|
116
|
-
- Centered with automatic inline margins
|
|
117
|
-
|
|
118
|
-
**Typography Helpers:**
|
|
119
|
-
|
|
120
|
-
- `sub` elements: styled for multi-line subtitles with top vertical alignment, `1.1` line height, lighter weight (`300`), and displayed as `inline-block` with `100%` width to prevent underline decoration inside links
|
|
121
|
-
|
|
122
|
-
**Links:**
|
|
123
|
-
|
|
124
|
-
- Custom underline offset (`0.1em`) and thickness (`1px` default, `2px` on hover)
|
|
125
|
-
- Anchor links (starting with `#`) have no text decoration
|
|
126
|
-
- Icon helper: `i` elements inside links are displayed as `inline-block` with normal font style to prevent underline decoration, with `1em` height and `0.25em` right margin. Nested `img` elements are styled with `100%` height, no margin, and positioned `0.15em` from the bottom for proper alignment
|
|
127
|
-
|
|
128
|
-
**Headings:**
|
|
129
|
-
|
|
130
|
-
- `h1` elements have a `0.5em` bottom margin
|
|
131
|
-
- `h1 sub` elements get reduced font size (`50%`)
|
|
132
|
-
- Support for heading anchors via `.header-anchor` class (displayed on hover to the left of the heading)
|
|
133
|
-
|
|
134
|
-
**Tables:**
|
|
135
|
-
|
|
136
|
-
- Tables within `.breakout` containers are automatically styled for full-bleed display and horizontal scrolling
|
|
137
|
-
- Table cells (`th` and `td`) have padding of `1rem 2rem 1rem 0` (extra space on the right for better horizontal scroll on mobile) and `top` vertical alignment
|
|
138
|
-
- Table headers (`th`) have `bottom` vertical alignment
|
|
139
|
-
- Workaround for widening columns using hidden `hr` elements (width: `12ch`, with zero margin and hidden visibility)
|
|
140
|
-
- Support for headings in Markdown tables using `big` elements (styled as bold)
|
|
141
|
-
- Images in table cells have no top margin and `1em` bottom margin
|
|
142
|
-
|
|
143
|
-
**Blockquotes:**
|
|
144
|
-
|
|
145
|
-
- Lighter font weight (`300`)
|
|
146
|
-
- Adjacent `figcaption` elements (using `+ figcaption` selector) are styled with italic text, right alignment, lighter weight (`300`), negative top margin (`-1em`), and an em dash prefix (`—`) with `0.25em` right margin
|
|
147
|
-
|
|
148
|
-
**Code Blocks:**
|
|
149
|
-
|
|
150
|
-
- Code blocks with `data-caption` attribute display the caption above the code block (styled with 50% opacity, italic, and `1.5em` bottom margin)
|
|
151
|
-
|
|
152
|
-
</details>
|
|
153
|
-
|
|
154
|
-
### `_prism.css` enhancements
|
|
155
|
-
|
|
156
|
-
Includes specialized styling for Prism.js, specifically focusing on treeview components:
|
|
157
|
-
|
|
158
|
-
- Custom styling for `.token.treeview-part`
|
|
159
|
-
- Reduced opacity for entry lines (25%) and names (50%) to create a hierarchical visual effect
|
|
160
|
-
- Entry lines have a fixed width of `2.5em`
|
|
161
|
-
- Last-child entry names have no `::before` pseudo-element
|
|
162
|
-
- Supports complex file tree visualizations out of the box
|
|
163
|
-
|
|
164
|
-
<details><summary>
|
|
165
|
-
|
|
166
|
-
### `_util.css` helpers
|
|
167
|
-
|
|
168
|
-
</summary>
|
|
169
|
-
|
|
170
|
-
#### Scrollbar Inversion
|
|
171
|
-
|
|
172
|
-
The `.invert` class can be used to invert the scrollbar colors, which is particularly useful for dark themes or specific UI components:
|
|
173
|
-
|
|
174
|
-
```css
|
|
175
|
-
.invert {
|
|
176
|
-
::-webkit-scrollbar {
|
|
177
|
-
filter: invert(1) !important;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
#### Link Whitespace Control
|
|
183
|
-
|
|
184
|
-
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:
|
|
185
|
-
|
|
186
|
-
```html
|
|
187
|
-
<a href="#" class="whitespace-nowrap">
|
|
188
|
-
<i><img src="icon.svg" alt="" /></i>Stay with me
|
|
189
|
-
</a>
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
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`.
|
|
193
|
-
|
|
194
|
-
**Usage:**
|
|
195
|
-
|
|
196
|
-
```html
|
|
197
|
-
<article class="prose">
|
|
198
|
-
<h1>Article Title</h1>
|
|
199
|
-
<p>Your content here...</p>
|
|
200
|
-
</article>
|
|
65
|
+
@import "@anydigital/blades";
|
|
66
|
+
@import "@anydigital/blades.theme"; /* optional */
|
|
201
67
|
```
|
|
202
68
|
|
|
203
|
-
|
|
69
|
+
Living example: https://github.com/anydigital/build-awesome-starter/blob/main/_styles/styles.css
|
|
204
70
|
|
|
205
71
|
</details>
|
|
72
|
+
<!--section:index-->
|
|
206
73
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
Includes [breakout-css](https://github.com/anydigital/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:
|
|
210
|
-
|
|
211
|
-
```html
|
|
212
|
-
<div class="breakout">
|
|
213
|
-
<img src="image.jpg" alt="Description" />
|
|
214
|
-
</div>
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
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.
|
|
74
|
+
---
|
|
218
75
|
|
|
219
|
-
|
|
76
|
+
## <sup>Nunjucks / Liquid</sup><br> [HTML blades](https://blades.ninja/html/) <br><sub>for 11ty/Build Awesome, Jekyll, etc.</sub>
|
|
220
77
|
|
|
221
|
-
|
|
78
|
+
- [Base HTML](https://blades.ninja/html/#base) <!--{data-marker=🥷}-->
|
|
79
|
+
- [Links](https://blades.ninja/html/#links)
|
|
80
|
+
- [Sitemap](https://blades.ninja/html/#sitemap)
|
|
81
|
+
- [Google Tag Manager](https://blades.ninja/html/#gtm)
|
|
222
82
|
|
|
223
|
-
|
|
83
|
+
<!--{.columns}-->
|
|
224
84
|
|
|
225
|
-
|
|
85
|
+
<!--section:index,install-html-->
|
|
86
|
+
<details><summary role="button" class="outline"><b>Install HTML blades</b></summary>
|
|
226
87
|
|
|
227
88
|
```sh
|
|
228
89
|
npm install @anydigital/blades
|
|
229
|
-
cd ./
|
|
230
|
-
ln -s
|
|
90
|
+
cd ./_includes # your includes dir
|
|
91
|
+
ln -s ../node_modules/@anydigital/blades/_includes/blades
|
|
231
92
|
```
|
|
232
93
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
A unified base HTML template `blades/__html.{njk|liquid}` that provides the essential document structure with built-in support for modern web best practices.
|
|
236
|
-
|
|
237
|
-
**Usage:**
|
|
94
|
+
That's it! Now you can use HTML blades in your templates like this:
|
|
238
95
|
|
|
239
|
-
```jinja2 {data-caption=
|
|
240
|
-
{% extends 'blades/
|
|
241
|
-
|
|
242
|
-
{% block body %}
|
|
243
|
-
<!-- YOUR page content -->
|
|
244
|
-
{% endblock %}
|
|
96
|
+
```jinja2 {data-caption=Nunjucks}
|
|
97
|
+
{% extends 'blades/html.njk' %}
|
|
98
|
+
{% include 'blades/gtm.njk' %}
|
|
245
99
|
```
|
|
246
100
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
{%
|
|
251
|
-
<!-- YOUR page content -->
|
|
252
|
-
{% endcapture %}
|
|
253
|
-
|
|
254
|
-
{% include 'blades/__html' %}
|
|
101
|
+
```liquid {data-caption=Liquid}
|
|
102
|
+
{% include blades/html.liquid %}
|
|
103
|
+
{% include blades/gtm.liquid for_body=true %}
|
|
104
|
+
{% render blades/links, links: site.links, current_url: page.url %}
|
|
255
105
|
```
|
|
256
106
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
**Features:**
|
|
260
|
-
|
|
261
|
-
- HTML5 DOCTYPE with language attribute (defaults to `en`, configurable via `site.lang`)
|
|
262
|
-
- UTF-8 charset and comprehensive viewport meta tag with `viewport-fit=cover` for notched devices
|
|
263
|
-
- Dynamic title generation with site title suffix (title is stripped of HTML tags and separated with `|`)
|
|
264
|
-
- Favicon link (to `/favicon.ico`)
|
|
265
|
-
- Automatic stylesheet linking from `site.styles` array
|
|
266
|
-
- Inline styles from `site.inline_styles` array (joined with newlines in a `<style>` tag)
|
|
267
|
-
- Automatic script loading from `site.scripts` array (with `defer` attribute)
|
|
268
|
-
- Inline module scripts from `site.inline_scripts` array (joined with newlines in a `<script type="module">` tag)
|
|
269
|
-
- Custom header content via `content_for_header`
|
|
270
|
-
- Google Tag Manager integration (automatically rendered via `_gtm.{njk|liquid}` template for both `<head>` and `<body>` when `site.prod` and `site.gtm_id` are set)
|
|
271
|
-
|
|
272
|
-
**Variables:**
|
|
273
|
-
|
|
274
|
-
- `body` - The page content to be rendered inside the `<body>` tag (required)
|
|
275
|
-
- `title` - Page title (optional, will be stripped of HTML tags)
|
|
276
|
-
- `site.title` - Site title for the title suffix
|
|
277
|
-
- `site.lang` - Language code (optional, defaults to `'en'`)
|
|
278
|
-
- `site.styles` - Array of stylesheet URLs (optional)
|
|
279
|
-
- `site.inline_styles` - Array of inline CSS strings (optional)
|
|
280
|
-
- `site.scripts` - Array of script URLs (optional)
|
|
281
|
-
- `site.inline_scripts` - Array of inline JavaScript strings (optional)
|
|
282
|
-
- `content_for_header` - Custom HTML for the head section (optional)
|
|
283
|
-
- `site.gtm_id` - Google Tag Manager ID (optional)
|
|
284
|
-
- `site.prod` - Boolean flag for production environment (optional)
|
|
285
|
-
|
|
286
|
-
### Navigation <small>(`_nav.*`)</small>
|
|
287
|
-
|
|
288
|
-
A navigation template `blades/_nav.{njk|liquid}` that renders a list of navigation links with proper accessibility attributes.
|
|
289
|
-
|
|
290
|
-
**Parameters:**
|
|
107
|
+
</details>
|
|
291
108
|
|
|
292
|
-
|
|
293
|
-
- `current_url` - The URL of the current page (used to set `aria-current="page"`)
|
|
109
|
+
---
|
|
294
110
|
|
|
295
|
-
|
|
111
|
+
All CSS and HTML blades above are available as a Jekyll theme:
|
|
296
112
|
|
|
297
|
-
|
|
298
|
-
{% assign nav_pages = collections.all | eleventyNavigation %}
|
|
299
|
-
{% render 'blades/_nav', nav_pages: nav_pages, current_url: page.url %}
|
|
300
|
-
```
|
|
113
|
+
<details><summary role="button" class="outline"><b>Install as Jekyll theme</b></summary>
|
|
301
114
|
|
|
302
|
-
|
|
115
|
+
In you `_config.yml`:
|
|
303
116
|
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
<a href="/contact">Contact</a>
|
|
309
|
-
</nav>
|
|
117
|
+
```yaml
|
|
118
|
+
remote_theme: anydigital/blades@v0.27.0-beta # or latest
|
|
119
|
+
plugins:
|
|
120
|
+
- jekyll-remote-theme
|
|
310
121
|
```
|
|
311
122
|
|
|
312
|
-
|
|
123
|
+
Living example: https://github.com/anydigital/bladeswitch/blob/main/_config.yml
|
|
313
124
|
|
|
314
|
-
|
|
125
|
+
</details>
|
|
315
126
|
|
|
316
|
-
|
|
127
|
+
Or use a preconfigured template:
|
|
317
128
|
|
|
318
|
-
|
|
129
|
+
[🥷 Bladeswitch Starter ↗ <small style="white-space: nowrap">Jekyll ⁺ Pico ⁺ Blades</small>](https://github.com/anydigital/bladeswitch)<!--{role=button .outline}-->
|
|
319
130
|
|
|
320
|
-
|
|
131
|
+
<!--section:gh-only-->
|
|
321
132
|
|
|
322
|
-
|
|
323
|
-
- `site.prod` - Boolean flag to enable GTM only in production
|
|
324
|
-
- `for_body` - Boolean flag (default: `false`). When `false`, renders the script tag for the `<head>`. When `true`, renders the noscript fallback for the `<body>`.
|
|
133
|
+
---
|
|
325
134
|
|
|
326
|
-
|
|
135
|
+
<!--section:appendix-->
|
|
327
136
|
|
|
328
|
-
-
|
|
329
|
-
- https://github.com/
|
|
137
|
+
- Featured by:
|
|
138
|
+
- https://github.com/uhub/awesome-css
|
|
139
|
+
- 🕶️ [awesome-eleventy](https://github.com/anydigital/awesome-11ty-build-awesome)
|
|
140
|
+
- [https://jekyll-themes.com/](https://jekyll-themes.com/anydigital/blades)
|
|
141
|
+
- Credits:
|
|
142
|
+
- https://picocss.com/ for inspiration
|
|
143
|
+
- https://11ty.dev/ for build power
|
|
330
144
|
|
|
331
|
-
|
|
145
|
+
<!--{.unlist .columns}-->
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
{% comment %}<!--section:code-->```liquid{% endcomment %}
|
|
1
2
|
{% if site.prod and site.gtm_id %}
|
|
2
3
|
{% capture _ %}
|
|
3
4
|
{% unless for_body %}
|
|
@@ -21,3 +22,18 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|
|
21
22
|
{% endcapture %}
|
|
22
23
|
{{ _ | strip }}
|
|
23
24
|
{% endif %}
|
|
25
|
+
<!--prettier-ignore-->
|
|
26
|
+
{% comment %}```
|
|
27
|
+
<!--section:docs-->
|
|
28
|
+
Usage in Liquid:
|
|
29
|
+
```liquid
|
|
30
|
+
...
|
|
31
|
+
{% include blades/gtm.liquid %}
|
|
32
|
+
</head>
|
|
33
|
+
<body>
|
|
34
|
+
{% include blades/gtm.liquid for_body=true %}
|
|
35
|
+
...
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Living example: https://github.com/anydigital/blades/blob/main/_includes/blades/html.liquid
|
|
39
|
+
<!--section-->{% endcomment %}
|
package/_includes/blades/gtm.njk
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
{# <!--section:code-->```jinja2 #}
|
|
1
2
|
{% if site.prod and site.gtm_id %}
|
|
2
3
|
{# prettier-ignore-start #}
|
|
3
4
|
{% if not for_body %}
|
|
@@ -20,3 +21,22 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|
|
20
21
|
{% endif %}
|
|
21
22
|
{# prettier-ignore-end #}
|
|
22
23
|
{% endif %}
|
|
24
|
+
{#```
|
|
25
|
+
<!--section:docs-->
|
|
26
|
+
Usage in Nunjucks:
|
|
27
|
+
```jinja2
|
|
28
|
+
...
|
|
29
|
+
{% include 'blades/gtm.njk' %}
|
|
30
|
+
</head>
|
|
31
|
+
<body>
|
|
32
|
+
{% set for_body = true %}{% include 'blades/gtm.njk' %}
|
|
33
|
+
...
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Living example: https://github.com/anydigital/blades/blob/main/_includes/blades/html.njk
|
|
37
|
+
|
|
38
|
+
Parameters:
|
|
39
|
+
- `site.gtm_id` - Your Google Tag Manager container ID (e.g., `GTM-XXXXXXX`)
|
|
40
|
+
- `site.prod` - Boolean flag to enable GTM only in production
|
|
41
|
+
- `for_body` - Boolean flag (default: `false`). When `false`, renders the script tag for the `<head>`. When `true`, renders the noscript fallback for the `<body>`.
|
|
42
|
+
<!--section--> #}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{% comment %}
|
|
1
|
+
{% comment %}<!--section:code-->```liquid{% endcomment %}
|
|
2
2
|
<!doctype html>
|
|
3
3
|
<html lang="{{ site.lang | default: 'en' }}">
|
|
4
4
|
<head>
|
|
@@ -36,17 +36,14 @@
|
|
|
36
36
|
</body>
|
|
37
37
|
</html>
|
|
38
38
|
{% comment %}```
|
|
39
|
-
|
|
40
39
|
<!--section:docs-->
|
|
40
|
+
Usage in Liquid layout:
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```liquid {data-caption=default.liquid}
|
|
42
|
+
```liquid
|
|
45
43
|
{% capture body %}...{% endcapture %}
|
|
46
44
|
|
|
47
45
|
{% include blades/html.liquid %}
|
|
48
46
|
```
|
|
49
47
|
|
|
50
48
|
Living example: https://github.com/anydigital/bladeswitch/blob/main/_includes/default.liquid
|
|
51
|
-
|
|
52
|
-
<!--section--> {% endcomment %}
|
|
49
|
+
<!--section-->{% endcomment %}
|
|
@@ -36,19 +36,16 @@
|
|
|
36
36
|
</body>
|
|
37
37
|
</html>
|
|
38
38
|
{#```
|
|
39
|
-
|
|
40
39
|
- `title | string` avoids error with `| striptags` when you pass a pure number.
|
|
41
40
|
|
|
42
41
|
<!--section:docs-->
|
|
42
|
+
Usage in Nunjucks layout:
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```jinja2 {data-caption=default.njk}
|
|
44
|
+
```jinja2
|
|
47
45
|
{% extends 'blades/html.njk' %}
|
|
48
46
|
|
|
49
47
|
{% block body %}...{% endblock %}
|
|
50
48
|
```
|
|
51
49
|
|
|
52
50
|
Living example: https://github.com/anydigital/build-awesome-starter/blob/main/_includes/default.njk
|
|
53
|
-
|
|
54
51
|
<!--section--> #}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
{% comment %}<!--section:code-->```liquid{% endcomment %}
|
|
1
2
|
<ul>
|
|
2
3
|
{%- for link in links %}
|
|
3
4
|
<li>
|
|
@@ -8,9 +9,19 @@
|
|
|
8
9
|
</li>
|
|
9
10
|
{%- endfor %}
|
|
10
11
|
</ul>
|
|
12
|
+
{% # prettier-ignore %}
|
|
13
|
+
{% comment %}```
|
|
14
|
+
<!--section:docs-->
|
|
15
|
+
Usage with [Eleventy Navigation plugin](https://www.11ty.dev/docs/plugins/navigation/#bring-your-own-html-render-the-menu-items-manually):
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
```liquid
|
|
18
|
+
{% assign links = collections.all | eleventyNavigation %}
|
|
19
|
+
{% render blades/links, links: links, current_url: page.url %}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Usage inside Pico's Navar:
|
|
23
|
+
|
|
24
|
+
```jinja2
|
|
25
|
+
TBD
|
|
26
|
+
```
|
|
27
|
+
<!--section-->{% endcomment %}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
3
|
+
{%- for page in collections.all %}
|
|
4
|
+
{% if page.data.permalink != false %}
|
|
5
|
+
<url>
|
|
6
|
+
<loc>{{ site.base }}{{ page.url }}</loc>
|
|
7
|
+
<lastmod>{{ page.date | date }}</lastmod>
|
|
8
|
+
</url>
|
|
9
|
+
{% endif %}
|
|
10
|
+
{%- endfor %}
|
|
11
|
+
</urlset>
|
|
12
|
+
{# https://github.com/11ty/eleventy-base-blog/blob/main/content/sitemap.xml.njk #}
|