From 5c99e9ae2ce1eb83ed31c660811bd72f0c3d0cb6 Mon Sep 17 00:00:00 2001 From: Christine Tham Date: Fri, 10 Feb 2023 21:14:38 +1100 Subject: [PATCH] Fixed asset loading issue with base --- README.md | 3 +- astro.config.mjs | 1 + package.json | 10 +- src/components/carousel.astro | 3 + src/components/lightbox.astro | 9 +- src/components/map.astro | 7 + yarn.lock | 233 +++++++++++++++++----------------- 7 files changed, 135 insertions(+), 131 deletions(-) diff --git a/README.md b/README.md index 3a5bb3c..82445a5 100644 --- a/README.md +++ b/README.md @@ -150,4 +150,5 @@ All commands are run from the root of the project, from a terminal: personal blog, including Next/Prev links, photo gallery support in Markdown, and improved pagination control. - 2.2.0: Fixed lint errors, reimplemented map, lightbox and carousel to use - leaflet, photoswipe and swiper packages instead of relying on external CDN. \ No newline at end of file + leaflet, photoswipe and swiper packages instead of relying on external CDN. +- 2.2.1: Update to astro 2.0.10, fixed asset loading issue with base diff --git a/astro.config.mjs b/astro.config.mjs index b54a223..3e739f1 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -17,6 +17,7 @@ export default defineConfig({ vite: { ssr: { external: ['svgo'], + noExternal: ['swiper', 'leaflet'], }, }, site: 'https://hellotham.github.io', diff --git a/package.json b/package.json index 803de69..81212a6 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "devDependencies": { "@akebifiky/remark-simple-plantuml": "^1.0.2", "@astrojs/alpinejs": "^0.1.3", - "@astrojs/image": "^0.14.0", + "@astrojs/image": "^0.14.1", "@astrojs/mdx": "^0.16.0", "@astrojs/sitemap": "^1.0.1", "@astrojs/tailwind": "^3.0.1", @@ -26,8 +26,8 @@ "@types/leaflet": "^1.9.0", "@types/photoswipe": "^4.1.2", "alpinejs": "^3.11.1", - "astro": "2.0.6", - "astro-robots-txt": "^0.3.11", + "astro": "^2.0.10", + "astro-robots-txt": "^0.3.12", "exifr": "^7.1.3", "mdast-util-to-string": "^3.1.1", "prettier-plugin-astro": "^0.8.0", @@ -35,7 +35,7 @@ "rehype-katex": "^6.0.2", "remark-math": "^5.1.1", "schema-dts": "^1.1.0", - "tailwindcss": "^3.2.4", + "tailwindcss": "^3.2.6", "unist-util-visit": "^4.1.2" }, "dependencies": { @@ -49,6 +49,6 @@ "mermaid": "^9.3.0", "photoswipe": "^5.3.5", "photoswipe-dynamic-caption-plugin": "^1.2.7", - "swiper": "^9.0.3" + "swiper": "^9.0.4" } } diff --git a/src/components/carousel.astro b/src/components/carousel.astro index dda5903..ac72db1 100644 --- a/src/components/carousel.astro +++ b/src/components/carousel.astro @@ -1,4 +1,6 @@ --- +import 'swiper/css/bundle' + export interface Props { pages: { name: string @@ -44,6 +46,7 @@ const images = folderFiles.map(image => imageFiles[image]) // import Swiper styles import 'swiper/css/bundle' + var swiper = new Swiper('.mySwiper', { cssMode: true, lazy: true, diff --git a/src/components/lightbox.astro b/src/components/lightbox.astro index 56eb192..4c6bf8c 100644 --- a/src/components/lightbox.astro +++ b/src/components/lightbox.astro @@ -1,5 +1,6 @@ --- - +import 'photoswipe/style.css' +import 'photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.css' import { Image } from '@astrojs/image/components' import exifr from 'exifr' @@ -13,16 +14,14 @@ const { id, images } = Astro.props const imageFiles = import.meta.glob('../images/**/*.{png,webp,jpg,jpeg}', { import: 'default', eager: true }) const imageSrcs = images.map(image => imageFiles[image]) const imagetitles = images.map(image => image.slice(0, image.lastIndexOf('.')).slice(image.lastIndexOf('/') + 1)) -// console.log(images) const exifs = [] as Record[] for (let i in images) { const exif = await exifr.parse(images[i].replace('../', './src/')) exifs.push(exif) } -// console.log(exifs) --- -