@anydigital/blades 0.27.0-alpha.16 → 0.27.0-beta.2
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 +93 -261
- 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/assets/blades.css +234 -149
- package/assets/breakout.css +14 -3
- package/assets/responsive-table.css +3 -3
- package/blades.gemspec +1 -1
- package/package.json +3 -4
- package/src/_code.css +45 -0
- package/src/_layout.css +59 -0
- package/src/_link.css +28 -0
- package/src/_table.css +7 -9
- package/src/_typography.css +62 -0
- package/src/_unreduce-motion.css +4 -3
- package/src/_utilities.css +43 -0
- package/src/blades.css +6 -9
- package/src/breakout.css +14 -2
- package/src/responsive-table.css +3 -3
- 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,163 @@
|
|
|
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
7
|
<big>Use with Pico, Tailwind, or any other CSS reset/framework.</big>
|
|
8
8
|
|
|
9
|
+

|
|
10
|
+
[](https://github.com/anydigital/blades)
|
|
11
|
+
|
|
9
12
|
<!--section-->
|
|
10
13
|
|
|
11
14
|
Nunjucks/Liquid batteries included (for 11ty/Build Awesome, Jekyll, etc.) 🥷
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## CSS 'blades' <br><sub>from https://github.com/anydigital/blades</sub> <a id="blades"></a>
|
|
16
|
-
|
|
17
|
-
### Install CSS
|
|
18
|
-
|
|
19
|
-
Via CDN:
|
|
20
|
-
|
|
21
|
-
```html
|
|
22
|
-
<link href="https://cdn.jsdelivr.net/npm/@anydigital/blades@0/dist/blades.min.css" rel="stylesheet" />
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Or import source styles via npm:
|
|
26
|
-
|
|
27
|
-
```sh
|
|
28
|
-
npm install @anydigital/blades
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
```css {data-caption=.css}
|
|
32
|
-
@import "@anydigital/blades";
|
|
33
|
-
```
|
|
16
|
+
[](https://blades.ninja/)
|
|
34
17
|
|
|
35
|
-
|
|
18
|
+
---
|
|
36
19
|
|
|
37
|
-
|
|
20
|
+
<!--section:index-->
|
|
38
21
|
|
|
39
|
-
</
|
|
22
|
+
<hgroup id="css"><small>Class-light</small>
|
|
40
23
|
|
|
41
|
-
|
|
24
|
+
## [CSS blades](https://blades.ninja/css/)
|
|
42
25
|
|
|
43
|
-
|
|
26
|
+
inspired by Pico.css
|
|
44
27
|
|
|
45
|
-
|
|
46
|
-
html,
|
|
47
|
-
body {
|
|
48
|
-
overflow-x: clip;
|
|
49
|
-
}
|
|
50
|
-
```
|
|
28
|
+
</hgroup>
|
|
51
29
|
|
|
52
|
-
|
|
30
|
+
<!-- copy-paste of ToC from https://blades.ninja/css/ -->
|
|
31
|
+
<ul class="unlist columns">
|
|
32
|
+
<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>
|
|
33
|
+
<li><a href="https://blades.ninja/css/#horizontal-expanders">Horizontal expanders</a></li>
|
|
34
|
+
<li><a href="https://blades.ninja/css/#borderless-table">Borderless table</a></li></ul></li>
|
|
35
|
+
<li><a href="https://blades.ninja/css/#content">Content</a><ul><li><a href="https://blades.ninja/css/#link-fav-icons">Link [fav]icons</a></li>
|
|
36
|
+
<li><a href="https://blades.ninja/css/#heading-anchors">Heading anchors</a></li>
|
|
37
|
+
<li><a href="https://blades.ninja/css/#list-markers">List markers</a></li>
|
|
38
|
+
<li><a href="https://blades.ninja/css/#code">Code</a></li></ul></li>
|
|
39
|
+
<li><a href="https://blades.ninja/css/#layout">Layout</a><ul><li><a href="https://blades.ninja/css/breakout/">🥷 Breakout elements →</a></li>
|
|
40
|
+
<li><a href="https://blades.ninja/css/#document">Document</a></li>
|
|
41
|
+
<li><a href="https://blades.ninja/css/#landmarks">Landmarks</a></li>
|
|
42
|
+
<li><a href="https://blades.ninja/css/#table-of-contents">Table of contents</a></li>
|
|
43
|
+
<li><a href="https://blades.ninja/css/#jump-to-top">Jump to top</a></li></ul></li>
|
|
44
|
+
<li><a href="https://blades.ninja/css/#utilities">Utilities</a><ul><li><a href="https://blades.ninja/css/#auto-columns">Auto-columns</a></li>
|
|
45
|
+
<li><a href="https://blades.ninja/css/#auto-dark">Auto-dark</a></li>
|
|
46
|
+
<li><a href="https://blades.ninja/css/#misc">Misc</a></li></ul></li></ul>
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
<!--section:index,install-css-->
|
|
49
|
+
<details><summary role="button" class="outline"><b>Install CSS blades</b></summary>
|
|
55
50
|
|
|
56
|
-
|
|
51
|
+
<mark>Option A.</mark> From CDN:
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
<!--prettier-ignore-->
|
|
54
|
+
```html
|
|
55
|
+
<link href="https://cdn.jsdelivr.net/npm/@anydigital/blades@^0.27.0-alpha/assets/blades.min.css" rel="stylesheet" />
|
|
56
|
+
<link href="https://cdn.jsdelivr.net/npm/@anydigital/blades@^0.27.0-alpha/assets/blades.theme.min.css" rel="stylesheet" /><!-- optional -->
|
|
62
57
|
```
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
#### Flexbox Layout
|
|
59
|
+
<mark>Option B.</mark> Via npm:
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```css
|
|
71
|
-
body {
|
|
72
|
-
display: flex;
|
|
73
|
-
flex-direction: column;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
body > main {
|
|
77
|
-
flex-grow: 1;
|
|
78
|
-
}
|
|
61
|
+
```sh
|
|
62
|
+
npm install @anydigital/blades
|
|
79
63
|
```
|
|
80
64
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
This is automatically applied when you include the stylesheet.
|
|
84
|
-
|
|
85
|
-
#### Typography Enhancements
|
|
86
|
-
|
|
87
|
-
Improves text rendering and readability:
|
|
65
|
+
Then import in your .css:
|
|
88
66
|
|
|
89
67
|
```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>
|
|
68
|
+
@import "@anydigital/blades";
|
|
69
|
+
@import "@anydigital/blades.theme"; /* optional */
|
|
201
70
|
```
|
|
202
71
|
|
|
203
|
-
|
|
72
|
+
Living example: https://github.com/anydigital/build-awesome-starter/blob/main/_styles/styles.css
|
|
204
73
|
|
|
205
74
|
</details>
|
|
75
|
+
<!--section:index-->
|
|
206
76
|
|
|
207
|
-
|
|
77
|
+
---
|
|
208
78
|
|
|
209
|
-
|
|
79
|
+
<hgroup><small>Nunjucks / Liquid</small>
|
|
210
80
|
|
|
211
|
-
|
|
212
|
-
<div class="breakout">
|
|
213
|
-
<img src="image.jpg" alt="Description" />
|
|
214
|
-
</div>
|
|
215
|
-
```
|
|
81
|
+
## [HTML blades](https://blades.ninja/html/)
|
|
216
82
|
|
|
217
|
-
|
|
83
|
+
for 11ty/Build Awesome, Jekyll, etc.
|
|
218
84
|
|
|
219
|
-
|
|
85
|
+
</hgroup>
|
|
220
86
|
|
|
221
|
-
|
|
87
|
+
- [Base HTML](https://blades.ninja/html/#base) {data-marker=🥷}
|
|
88
|
+
- [Links](https://blades.ninja/html/#links)
|
|
89
|
+
- [Google Tag Manager](https://blades.ninja/html/#gtm)
|
|
222
90
|
|
|
223
|
-
|
|
91
|
+
{.columns}
|
|
224
92
|
|
|
225
|
-
|
|
93
|
+
<!--section:index,install-html-->
|
|
94
|
+
<details><summary role="button" class="outline"><b>Install HTML blades</b></summary>
|
|
226
95
|
|
|
227
96
|
```sh
|
|
228
97
|
npm install @anydigital/blades
|
|
229
|
-
cd ./
|
|
230
|
-
ln -s
|
|
98
|
+
cd ./_includes # or where your includes dir is
|
|
99
|
+
ln -s ../node_modules/@anydigital/blades/_includes/blades
|
|
231
100
|
```
|
|
232
101
|
|
|
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:**
|
|
102
|
+
That's it! Now you can use HTML blades in your templates like this:
|
|
238
103
|
|
|
239
|
-
```jinja2
|
|
240
|
-
{% extends 'blades/
|
|
241
|
-
|
|
242
|
-
{% block body %}
|
|
243
|
-
<!-- YOUR page content -->
|
|
244
|
-
{% endblock %}
|
|
104
|
+
```jinja2
|
|
105
|
+
{% extends 'blades/html.njk' %}
|
|
106
|
+
{% include 'blades/gtm.njk' %}
|
|
245
107
|
```
|
|
246
108
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
```liquid {data-caption="in .liquid layout:"}
|
|
250
|
-
{% capture body %}
|
|
251
|
-
<!-- YOUR page content -->
|
|
252
|
-
{% endcapture %}
|
|
109
|
+
or:
|
|
253
110
|
|
|
254
|
-
|
|
111
|
+
```liquid
|
|
112
|
+
{% include blades/html.liquid %}
|
|
113
|
+
{% include blades/gtm.liquid for_body=true %}
|
|
114
|
+
{% render blades/links, links: site.links, current_url: page.url %}
|
|
255
115
|
```
|
|
256
116
|
|
|
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)
|
|
117
|
+
</details>
|
|
271
118
|
|
|
272
|
-
|
|
119
|
+
<!--section:gh-only-->
|
|
273
120
|
|
|
274
|
-
|
|
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)
|
|
121
|
+
---
|
|
285
122
|
|
|
286
|
-
|
|
123
|
+
<!--section:appendix-->
|
|
287
124
|
|
|
288
|
-
|
|
125
|
+
<hgroup><small>Old-school</small><h2>Jekyll blades</h2><p></p></hgroup>
|
|
289
126
|
|
|
290
|
-
|
|
127
|
+
All CSS and HTML blades above are available as a Jekyll theme:
|
|
291
128
|
|
|
292
|
-
|
|
293
|
-
- `current_url` - The URL of the current page (used to set `aria-current="page"`)
|
|
129
|
+
<details><summary role="button" class="outline"><b>Install as Jekyll theme</b></summary>
|
|
294
130
|
|
|
295
|
-
|
|
131
|
+
In you `_config.yml`:
|
|
296
132
|
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
|
|
133
|
+
```yaml
|
|
134
|
+
remote_theme: anydigital/blades@v0.27.0-beta # or latest
|
|
135
|
+
plugins:
|
|
136
|
+
- jekyll-remote-theme
|
|
300
137
|
```
|
|
301
138
|
|
|
302
|
-
|
|
139
|
+
Living example: https://github.com/anydigital/bladeswitch/blob/main/_config.yml
|
|
303
140
|
|
|
304
|
-
|
|
305
|
-
<nav>
|
|
306
|
-
<a href="/">Home</a>
|
|
307
|
-
<a href="/about" aria-current="page">About</a>
|
|
308
|
-
<a href="/contact">Contact</a>
|
|
309
|
-
</nav>
|
|
310
|
-
```
|
|
141
|
+
</details>
|
|
311
142
|
|
|
312
|
-
|
|
143
|
+
Or use a preconfigured template:
|
|
313
144
|
|
|
314
|
-
|
|
145
|
+
[🥷 Bladeswitch Starter ↗ <small style="white-space: nowrap">Jekyll ⁺ Pico ⁺ Blades</small>](https://github.com/anydigital/bladeswitch){role=button .outline}
|
|
315
146
|
|
|
316
|
-
|
|
147
|
+
---
|
|
317
148
|
|
|
318
|
-
|
|
149
|
+
<div class="grid"><div>
|
|
319
150
|
|
|
320
|
-
|
|
151
|
+
Featured by:
|
|
321
152
|
|
|
322
|
-
-
|
|
323
|
-
-
|
|
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>`.
|
|
153
|
+
- https://github.com/uhub/awesome-css
|
|
154
|
+
- [awesome-eleventy](https://github.com/anydigital/awesome-11ty-build-awesome) list
|
|
325
155
|
|
|
326
|
-
|
|
156
|
+
</div><div>
|
|
327
157
|
|
|
328
|
-
|
|
329
|
-
- https://github.com/anydigital/blades/blob/main/blades/__html.liquid
|
|
158
|
+
Credits:
|
|
330
159
|
|
|
331
|
-
|
|
160
|
+
- https://picocss.com/ for inspiration
|
|
161
|
+
- https://11ty.dev/ for build power
|
|
162
|
+
|
|
163
|
+
</div></div>
|
|
@@ -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 %}
|