Skip to content

Commit c481bd7

Browse files
hHolyMollyclaude
andcommitted
fix(styles): complete the rem pattern, kill rubber-band white edges, drop demo image (v3.2.1)
- --header-height removed from :root (bare 0 would break calc; JS setProperty ignores the initial unit anyway) — commented rem() example left in vars.scss, calc fallback is now var(--header-height, 0rem) - restore overscroll-behavior: none + background on html — no more white rubber-band edges around the page - remove demo placeholder image and its picture block from the demo page (docs examples now use a neutral path) - pattern sweep verified: no px/rem/em literals left in src/styles outside the converter functions and the typed zero fallback Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent fbab8c1 commit c481bd7

8 files changed

Lines changed: 14 additions & 32 deletions

File tree

‎AGENTS.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ hand-editable. Keep it that way.
3939
Design tokens (colors/z-index/radius/header-height) in `styles/vars.scss`.
4040
- **Sizing pattern**: all sizes are written in pixels through `rem()` / `em()`
4141
(`rem(18)`, `rem(12 24)`, `rem(0 auto)`, `rem(320px)`, `em(20)`) — never raw
42-
`px`/`rem` literals in declarations. Exceptions: media queries inside
43-
`_mixins.scss` (px by design) and `--header-height` (px — set from JS).
42+
`px`/`rem` literals in declarations. Only exceptions: media queries inside
43+
`_mixins.scss` (px by design) and the typed zero fallback in
44+
`var(--header-height, 0rem)` (bare 0 breaks calc()).
4445
- **Critical CSS**: `optimization.criticalCSS: true` inlines compiled
4546
`critical.scss` into `<head>` (html task, `__CRITICAL_CSS__` placeholder) —
4647
it never compiles to a standalone file.

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Icons size from `font-size` and color from `currentColor` (`.icon` in `ui/_icon.
117117
The build creates a `.webp` sibling for every jpg/png (AVIF — opt-in via `images.avif`):
118118

119119
```html
120-
@@include('components/_picture.html', { "src": "./assets/img/demo", "ext": "jpg", "alt": "…", "class": "", "loading":
120+
@@include('components/_picture.html', { "src": "./assets/img/photo", "ext": "jpg", "alt": "…", "class": "", "loading":
121121
"lazy", "width": "1200", "height": "675" })
122122
```
123123

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gulp-template",
33
"description": "Modern Gulp 5 template for fast frontend development",
4-
"version": "3.2.0",
4+
"version": "3.2.1",
55
"private": true,
66
"type": "module",
77
"author": "HolyMolly",

‎src/assets/img/demo.jpg‎

-16 KB
Binary file not shown.

‎src/html/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Add an SVG to `src/assets/sprites/`, then:
5656
All params required; the `.webp` sibling is generated by the build:
5757

5858
```html
59-
@@include('components/_picture.html', { "src": "./assets/img/demo", "ext": "jpg", "alt": "…", "class": "", "loading":
59+
@@include('components/_picture.html', { "src": "./assets/img/photo", "ext": "jpg", "alt": "…", "class": "", "loading":
6060
"lazy", "width": "1200", "height": "675" })
6161
```
6262

‎src/html/components/demo.html‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,6 @@
226226
flex-shrink: 0;
227227
}
228228

229-
.demo__media {
230-
margin-top: 2.5rem;
231-
}
232-
233-
.demo__media img {
234-
width: 100%;
235-
height: auto;
236-
border-radius: 12px;
237-
}
238-
239229
.demo__footer {
240230
position: absolute;
241231
bottom: 1rem;
@@ -456,20 +446,6 @@ <h1 class="demo__title">
456446
Prettier
457447
</span>
458448
</div>
459-
460-
<!-- Responsive image demo: build generates the .webp sibling automatically -->
461-
<div class="demo__media">
462-
<!-- prettier-ignore -->
463-
@@include('components/_picture.html', {
464-
"src": "./assets/img/demo",
465-
"ext": "jpg",
466-
"alt": "Auto-generated WebP demo image",
467-
"class": "",
468-
"loading": "lazy",
469-
"width": "1200",
470-
"height": "675"
471-
})
472-
</div>
473449
</div>
474450

475451
<div class="demo__footer">

‎src/styles/normalize.scss‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
-webkit-tap-highlight-color: transparent;
1313
}
1414

15-
/* Smooth scroll with reduced motion support */
15+
/* Smooth scroll with reduced motion support.
16+
overscroll-behavior + background kill the white rubber-band edges */
1617
html {
1718
scroll-behavior: smooth;
1819
text-size-adjust: 100%;
20+
overscroll-behavior: none;
21+
background-color: var(--color-bg, #fff);
1922
}
2023

2124
@media (prefers-reduced-motion: reduce) {
@@ -176,7 +179,7 @@ ol {
176179

177180
/* Anchor targets stop below a fixed header (--header-height in vars.scss) */
178181
:target {
179-
scroll-margin-block-start: calc(var(--header-height, 0px) + #{rem(16)});
182+
scroll-margin-block-start: calc(var(--header-height, 0rem) + #{rem(16)});
180183
}
181184

182185
/* Tables */

‎src/styles/vars.scss‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
/* Layout */
1717
--container-width: #{rem(1230)};
1818
--container-padding: #{rem(15)};
19-
--header-height: 0px; /* stays in px — usually set from JS (getBoundingClientRect) for anchor offsets */
2019
--radius: #{rem(8)};
2120

21+
// Uncomment when the header is fixed/sticky — anchors offset by it (normalize.scss :target)
22+
// --header-height: #{rem(80)};
23+
2224
/* Z-index scale */
2325
--z-header: 100;
2426
--z-dropdown: 200;

0 commit comments

Comments
 (0)