From 7ff2985fb0d3b8cfe4bb36e3d9ef82b10ff7aa6a Mon Sep 17 00:00:00 2001 From: sHa Date: Fri, 20 Jun 2025 17:12:25 +0300 Subject: [PATCH] feat: enhance deployment output logging and update background image handling in Home component --- .github/workflows/deploy.yml | 8 +++++++- src/components/Home.svelte | 20 ++++++++++++++++---- vite.config.js | 11 ----------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 11005e0..2fe77ad 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -38,7 +38,13 @@ jobs: NODE_ENV: production - name: List build output - run: ls -la dist/ + run: | + echo "=== Dist directory contents ===" + ls -la dist/ + echo "=== Assets directory contents ===" + ls -la dist/assets/ || echo "No assets directory" + echo "=== Looking for background images ===" + find dist/ -name "*background*" -type f || echo "No background files found" - name: Setup Pages uses: actions/configure-pages@v4 diff --git a/src/components/Home.svelte b/src/components/Home.svelte index dd5c393..42b4fbb 100644 --- a/src/components/Home.svelte +++ b/src/components/Home.svelte @@ -12,11 +12,22 @@ ExternalLink, } from "lucide-svelte"; + // Import background images for proper Vite processing + import energyBg from '/energy-background.jpg?url'; + import retailBg from '/retail-background.jpg?url'; + import officeBg from '/office-background.jpg?url'; + import heroBgLight from '/hero-background.svg?url'; + import heroBgDark from '/hero-background-dark.svg?url'; + let mounted = false; onMount(() => { mounted = true; + // Set CSS custom properties for background images + document.documentElement.style.setProperty('--hero-bg-light', `url('${heroBgLight}')`); + document.documentElement.style.setProperty('--hero-bg-dark', `url('${heroBgDark}')`); + // Intersection Observer for scroll animations const observer = new IntersectionObserver( (entries) => { @@ -46,7 +57,7 @@ titleKey: "energy", descKey: "energy_desc", color: "#059669", - backgroundImage: "/energy-background.jpg", + backgroundImage: energyBg, }, { icon: TreePine, @@ -59,7 +70,7 @@ titleKey: "retail", descKey: "retail_desc", color: "#dc2626", - backgroundImage: "/retail-background.jpg", + backgroundImage: retailBg, }, { icon: Truck, @@ -72,7 +83,7 @@ titleKey: "real_estate", descKey: "real_estate_desc", color: "#d97706", - backgroundImage: "/office-background.jpg", + backgroundImage: officeBg, }, ]; @@ -281,7 +292,7 @@ /* Hero Section */ .hero { padding: 6rem 0; - background-image: url("/hero-background.jpg"); + background-image: var(--hero-bg-light); background-size: cover; background-position: center; background-repeat: no-repeat; @@ -293,6 +304,7 @@ } :global([data-theme="dark"]) .hero { + /* background-image: var(--hero-bg-dark); */ /* background-image: url('/hero-background-dark.svg'); */ text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); } diff --git a/vite.config.js b/vite.config.js index 31e70a5..2176ea5 100644 --- a/vite.config.js +++ b/vite.config.js @@ -10,17 +10,6 @@ export default defineConfig({ assetsDir: 'assets', sourcemap: false, minify: 'terser', - rollupOptions: { - output: { - assetFileNames: (assetInfo) => { - // Keep SVG files and other images in the root for easier path resolution - if (assetInfo.name?.endsWith('.svg') || assetInfo.name?.endsWith('.jpg') || assetInfo.name?.endsWith('.png')) { - return '[name][extname]' - } - return 'assets/[name]-[hash][extname]' - } - } - } }, server: { host: true,