Store images as single zip; add setup.sh and README workflow
- Compress resource/images/ (~31MB) into resource/images.zip and untrack the 62 individual binaries so future image changes do not bloat git history - Add setup.sh to unpack the zip after clone (idempotent) - gitignore resource/images/ and .DS_Store - Document run + image-management steps in README.md
This commit is contained in:
1 parent
b2383ca7d0
commit
ebcae74f3c
66 files changed
+50
-236
No files matched your search
@@ -17,14 +17,16 @@ web-at-transit-mock/
|
||||
│ └── partials/ view ละ 1 ไฟล์ (router fetch + inject)
|
||||
└── resource/
|
||||
├── data/ ← ข้อมูล mock: routes.json, schedules.json, stations.json, ...
|
||||
└── images/ ← รูปทั้งหมด
|
||||
├── images.zip ← ★ รูปทั้งหมด (บีบไว้ — แตกด้วย setup.sh)
|
||||
└── images/ ← (เกิดหลังรัน setup.sh — ไม่ commit)
|
||||
```
|
||||
|
||||
## วิธี run
|
||||
|
||||
```bash
|
||||
cd web-at-transit-mock
|
||||
python3 -m http.server 8090
|
||||
./setup.sh # 1. แตก resource/images.zip → resource/images/ (ครั้งเดียว)
|
||||
python3 -m http.server 8090 # 2. รัน static server
|
||||
```
|
||||
|
||||
แล้วเปิดเบราว์เซอร์ที่:
|
||||
@@ -35,10 +37,24 @@ http://localhost:8090/ui/index.html
|
||||
|
||||
### เงื่อนไขสำคัญ
|
||||
|
||||
1. **ต้อง serve จาก root ของ repo** (ไม่ใช่จาก `ui/`) — รูปและข้อมูลอ้างอิงด้วย
|
||||
relative path `../resource/...` ถ้า serve ผิดตำแหน่ง path จะพัง
|
||||
2. **ห้ามเปิด `file://`** — fetch JSON + relative path จะใช้ไม่ได้ ต้องผ่าน static server เสมอ
|
||||
3. เปลี่ยน port ได้โดยแก้เลข `8090` (เช่น `python3 -m http.server 8080`)
|
||||
1. **ต้องรัน `./setup.sh` ก่อน** — ไม่งั้นรูปพังทั้งหน้า (relative path `../resource/images/...` หาไฟล์ไม่เจอ)
|
||||
2. **ต้อง serve จาก root ของ repo** (ไม่ใช่จาก `ui/`) — รูปและข้อมูลอ้างอิงด้วย relative path
|
||||
3. **ห้ามเปิด `file://`** — fetch JSON + relative path จะใช้ไม่ได้ ต้องผ่าน static server เสมอ
|
||||
4. เปลี่ยน port ได้โดยแก้เลข `8090` (เช่น `python3 -m http.server 8080`)
|
||||
|
||||
## การจัดการรูปภาพ (images)
|
||||
|
||||
รูปทั้งหมด (~31MB) ถูกบีบเป็นไฟล์เดียว `resource/images.zip` เพื่อไม่ให้ git พองจาก binary:
|
||||
|
||||
- **แตกไฟล์**: `./setup.sh` (idempotent — ถ้ามี `resource/images/` แล้วจะข้าม)
|
||||
- **เพิ่ม/เปลี่ยนรูป**: แก้ที่ `resource/images/` แล้ว re-zip:
|
||||
|
||||
```bash
|
||||
cd resource && zip -r -X images.zip images -x "*.DS_Store"
|
||||
```
|
||||
|
||||
แล้ว commit `resource/images.zip`
|
||||
- **ห้าม commit ไฟล์ใน `resource/images/`** — อยู่ใน `.gitignore` แล้ว
|
||||
|
||||
## หมายเหตุ (ไม่ต้องแก้)
|
||||
|
||||
|
||||
Reference in new issue
Block a user