Skip to content

Commit 80a233b

Browse files
authored
Fix cloud background images to respect BASE_PATH (#5)
* Fix cloud background images to respect BASE_PATH Convert inline style background-image to Tailwind bg-[url(...)] classes so that Vite's CSS pipeline can automatically apply the base path. Problem: - Cloud images were using inline style attributes - Inline styles are not processed by Vite and don't get base path - This caused 404s on GitHub Pages subdirectory deployment Solution: - Use Tailwind arbitrary values: bg-[url('/images/...')] - Tailwind classes are processed through Vite's CSS pipeline - Base path is automatically applied during build Tested: - With BASE_PATH=/repo-name: URLs become /repo-name/images/cloud-*.jpg - Without BASE_PATH: URLs remain /images/cloud-*.jpg - Cloudflare Workers staging: works (BASE_PATH not set) - GitHub Pages subdirectory: will work (BASE_PATH set) * docs: document Tailwind usage for CSS images with BASE_PATH
1 parent 2858152 commit 80a233b

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

.claude/CLAUDE.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,8 @@ public/
7777

7878
## Styling & Components
7979

80-
Not yet defined. Decisions needed:
81-
- CSS approach (Tailwind, CSS modules, plain CSS, etc.)
82-
- Component library or custom
83-
- Dark mode strategy
84-
- Design system/tokens
80+
- **CSS Framework**: Tailwind CSS 4.1.17
81+
- **Images in CSS**: Always use Tailwind classes (e.g., `bg-[url('/images/...')]`) instead of inline styles, as Tailwind processes through Vite and respects BASE_PATH configuration
8582

8683
## Development Workflow
8784

src/components/AnimatedClouds.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747

4848
<div class="absolute inset-0 w-full h-full pointer-events-none overflow-hidden">
4949
<!-- Cloud Layer 1 - Slow -->
50-
<div class="fog-layer animate-fog-slow" style="background-image: url('/images/cloud-1.jpg');"></div>
50+
<div class="fog-layer animate-fog-slow bg-[url('/images/cloud-1.jpg')]"></div>
5151
<!-- Cloud Layer 2 - Fast -->
52-
<div class="fog-layer fog-layer-fast animate-fog-fast" style="background-image: url('/images/cloud-2.jpg');"></div>
52+
<div class="fog-layer fog-layer-fast animate-fog-fast bg-[url('/images/cloud-2.jpg')]"></div>
5353
<!-- Cloud Layer 3 - Medium -->
54-
<div class="fog-layer fog-layer-medium animate-fog-medium" style="background-image: url('/images/cloud-1.jpg');"></div>
54+
<div class="fog-layer fog-layer-medium animate-fog-medium bg-[url('/images/cloud-1.jpg')]"></div>
5555
</div>

0 commit comments

Comments
 (0)