Skip to content

Commit 5c99e9a

Browse files
committed
Fixed asset loading issue with base
1 parent 0004371 commit 5c99e9a

File tree

7 files changed

+135
-131
lines changed

7 files changed

+135
-131
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,5 @@ All commands are run from the root of the project, from a terminal:
150150
personal blog, including Next/Prev links, photo gallery support in Markdown,
151151
and improved pagination control.
152152
- 2.2.0: Fixed lint errors, reimplemented map, lightbox and carousel to use
153-
leaflet, photoswipe and swiper packages instead of relying on external CDN.
153+
leaflet, photoswipe and swiper packages instead of relying on external CDN.
154+
- 2.2.1: Update to astro 2.0.10, fixed asset loading issue with base

astro.config.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default defineConfig({
1717
vite: {
1818
ssr: {
1919
external: ['svgo'],
20+
noExternal: ['swiper', 'leaflet'],
2021
},
2122
},
2223
site: 'https://hellotham.github.io',

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"devDependencies": {
1515
"@akebifiky/remark-simple-plantuml": "^1.0.2",
1616
"@astrojs/alpinejs": "^0.1.3",
17-
"@astrojs/image": "^0.14.0",
17+
"@astrojs/image": "^0.14.1",
1818
"@astrojs/mdx": "^0.16.0",
1919
"@astrojs/sitemap": "^1.0.1",
2020
"@astrojs/tailwind": "^3.0.1",
@@ -26,16 +26,16 @@
2626
"@types/leaflet": "^1.9.0",
2727
"@types/photoswipe": "^4.1.2",
2828
"alpinejs": "^3.11.1",
29-
"astro": "2.0.6",
30-
"astro-robots-txt": "^0.3.11",
29+
"astro": "^2.0.10",
30+
"astro-robots-txt": "^0.3.12",
3131
"exifr": "^7.1.3",
3232
"mdast-util-to-string": "^3.1.1",
3333
"prettier-plugin-astro": "^0.8.0",
3434
"reading-time": "^1.5.0",
3535
"rehype-katex": "^6.0.2",
3636
"remark-math": "^5.1.1",
3737
"schema-dts": "^1.1.0",
38-
"tailwindcss": "^3.2.4",
38+
"tailwindcss": "^3.2.6",
3939
"unist-util-visit": "^4.1.2"
4040
},
4141
"dependencies": {
@@ -49,6 +49,6 @@
4949
"mermaid": "^9.3.0",
5050
"photoswipe": "^5.3.5",
5151
"photoswipe-dynamic-caption-plugin": "^1.2.7",
52-
"swiper": "^9.0.3"
52+
"swiper": "^9.0.4"
5353
}
5454
}

src/components/carousel.astro

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
import 'swiper/css/bundle'
3+
24
export interface Props {
35
pages: {
46
name: string
@@ -44,6 +46,7 @@ const images = folderFiles.map(image => imageFiles[image])
4446

4547
// import Swiper styles
4648
import 'swiper/css/bundle'
49+
4750
var swiper = new Swiper('.mySwiper', {
4851
cssMode: true,
4952
lazy: true,

src/components/lightbox.astro

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
2+
import 'photoswipe/style.css'
3+
import 'photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.css'
34
import { Image } from '@astrojs/image/components'
45
import exifr from 'exifr'
56
@@ -13,16 +14,14 @@ const { id, images } = Astro.props
1314
const imageFiles = import.meta.glob<ImageMetadata>('../images/**/*.{png,webp,jpg,jpeg}', { import: 'default', eager: true })
1415
const imageSrcs = images.map(image => imageFiles[image])
1516
const imagetitles = images.map(image => image.slice(0, image.lastIndexOf('.')).slice(image.lastIndexOf('/') + 1))
16-
// console.log(images)
1717
const exifs = [] as Record<string, any>[]
1818
for (let i in images) {
1919
const exif = await exifr.parse(images[i].replace('../', './src/'))
2020
exifs.push(exif)
2121
}
22-
// console.log(exifs)
2322
2423
---
25-
<style is:inline>
24+
<style>
2625
.gallery {
2726
width: 100%;
2827
display: block;
@@ -101,8 +100,6 @@ for (let i in images) {
101100
))}
102101
</lightbox-inner>
103102
<script>
104-
import 'photoswipe/style.css'
105-
import 'photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.css'
106103
import PhotoSwipeLightbox from 'photoswipe/lightbox'
107104
import PhotoSwipeDynamicCaption from 'photoswipe-dynamic-caption-plugin'
108105

src/components/map.astro

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
// import 'leaflet/dist/leaflet.css'
23
export interface Props {
34
loc: [number, number]
45
zoom: number
@@ -13,7 +14,13 @@ crossorigin=""/>
1314
<div id="map" class="mb-3 h-96"></div>
1415
<script>
1516
import L from 'leaflet'
17+
// delete L.Icon.Default.prototype._getIconUrl;
1618

19+
// L.Icon.Default.mergeOptions({
20+
// iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
21+
// iconUrl: require('leaflet/dist/images/marker-icon.png'),
22+
// shadowUrl: require('leaflet/dist/images/marker-shadow.png'),
23+
// });
1724
class MapInner extends HTMLElement {
1825
constructor() {
1926
super()

0 commit comments

Comments
 (0)