Skip to content

Commit d6eeb57

Browse files
committed
Change File Structuring + Add Webpack Compilation
1 parent a2d393a commit d6eeb57

31 files changed

Lines changed: 8113 additions & 66 deletions

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ lerna-debug.log*
1010
ai
1111
AGENTS.md
1212
/node_modules
13-
/dist
1413

1514
# Editor directories and files
1615
.vscode/*

README.md

Lines changed: 76 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# Zimbabwe National & Provincial Delimitation Maps
22

3-
Interactive SVG maps of Zimbabwe's 10 provinces with detailed ward boundaries. This prject is a demonstration of the practical use of interactive SVG graphics in websites and web apps.
3+
Interactive SVG maps of Zimbabwe's 10 provinces with detailed ward boundaries. I created this project demo to showcase the practical use of interactive SVG graphics in websites and web apps. This allowed me to upscale my creative technoligist services to local and some international clients.
44

55
**View Live Demo:** https://hikwamehluli.github.io/Zimbabwe-National-and-Provincial-Delimitation-Maps
66

7-
Real world examples of websites in Zimbabwe which interactive SVG's:
7+
Real world examples of websites in Zimbabwe with interactive SVG's:
88
- [Graylands Park](https://www.graylandspark.co.zw/stands)
99
- [Northgate Estates](https://portal.northgateestates.co.zw)
1010

1111
## Features
1212

13-
- :earth_africa: **National overview** — Zoomable SVG map of all 10 provinces on `index.html`
14-
- :city_sunset: **Per-province pages** — Detailed ward boundaries for each province
15-
- :mag: **Pan & zoom** — Drag to pan, buttons to zoom in/out/reset
16-
- :speech_balloon: **Tooltips** — Hover over any region to see its name (powered by TippyJS)
17-
- :handshake: **Touch-friendly** — Pinch-to-zoom and pan on mobile
13+
- **National overview** — Zoomable SVG map of all 10 provinces on `index.html`
14+
- **Per-province pages** — Detailed ward boundaries for each province with breadcrumb navigation
15+
- **Pan & zoom** — Drag to pan, buttons to zoom in/out/reset
16+
- **Tooltips** — Hover over any region to see its name (powered by TippyJS)
17+
- **Touch-friendly** — Pinch-to-zoom and pan on mobile
1818

1919
## Map index
2020

@@ -34,38 +34,93 @@ Real world examples of websites in Zimbabwe which interactive SVG's:
3434

3535
## Technical stack
3636

37-
- **Pure static site** — No build tools, no server, no framework. Open `.html` files directly in a browser.
37+
- **Pure static site** — No build tools required for viewing. Open `.html` files directly in a browser.
3838
- **SVG maps** — All map coordinates are inline `<polyline points="...">` in the HTML (no external data files)
39-
- **Libraries** (vendored in `js/`):
39+
- **Libraries** (bundled into `dist/js/app.js` via webpack):
4040
- `svg-pan-zoom` — Pan and zoom controls
4141
- `TippyJS` + `Popper.js` — Tooltip popups
42-
- **Font**: Roboto via Google Fonts
42+
- **Fonts**: Roboto + Pliant via Google Fonts
43+
- **Build tools**: Sass (SCSS → CSS), Webpack (JS bundling + CSS inlining)
44+
45+
### Setup & scripts
46+
47+
```bash
48+
npm install
49+
```
50+
51+
| Script | Command | What it does |
52+
|--------|---------|-------------|
53+
| `npm run css-dev` | `sass --no-source-map --watch src/scss/_entry.scss:dist/css/app.css` | Compile SCSS → CSS (expanded output, watch mode) |
54+
| `npm run css-prod` | `sass --no-source-map --watch src/scss/_entry.scss:dist/css/app.css --style compressed` | Compile SCSS → CSS (minified, watch mode) |
55+
| `npm run js-dev` | `webpack --mode development --watch` | Bundle JS (development mode, watch for changes) |
56+
| `npm run js-prod` | `webpack --mode production --watch` | Bundle JS (production/minified, watch for changes) |
57+
| `npm run start:public` | `http-server -c-1` | Serve files locally at `http://localhost:8080` (no caching) |
58+
| `npm run start:root` | `http-server . -c-1` | Same as above, explicit `.` root directory |
59+
60+
**dependencies:** `tippy.js` (tooltip library)
61+
62+
**devDependencies:**
63+
| Package | Purpose |
64+
|---------|---------|
65+
| `http-server` | Local dev server with no caching |
66+
| `sass` | SCSS → CSS compiler |
67+
| `webpack` + `webpack-cli` | JS bundler — bundles `src/js/_entry.js` and its imports into `dist/js/app.js` |
68+
| `css-loader` + `style-loader` | Webpack loaders — inline `tippy.js/dist/tippy.css` into the JS bundle as `<style>` tags |
69+
70+
### JS compilation pipeline
71+
72+
1. **Entry point:** `src/js/_entry.js`
73+
2. **Webpack** resolves bare imports (`popper.min.js`, `svg-pan-zoom.min.js`) from `src/js/`, and npm imports (`tippy.js`) from `node_modules/`
74+
3. **CSS imports** (e.g. `tippy.js/dist/tippy.css`) are inlined into the bundle via `style-loader` + `css-loader`
75+
4. **Output:** a single `dist/js/app.js` loaded by all HTML pages
76+
77+
Run `npm run js-dev` (development, unminified) or `npm run js-prod` (production, minified).
4378

4479
## Project structure
4580

4681
```
47-
css/
48-
style.css — Map colors, layout, typography
49-
icons-map.css — Icon font styles
50-
font/ — Icon font files
51-
js/
52-
popper.min.js
53-
tippy.min.js
54-
svg-pan-zoom.min.js
55-
script.js — Initializes pan/zoom and tooltips
56-
*.html — 11 HTML pages (1 national + 10 provincial)
82+
├── index.html National overview map
83+
├── {province}.html 10 per-province ward maps
84+
├── dist/
85+
│ ├── js/
86+
│ │ └── app.js Webpack-bundled JS (tippy.js, Popper, svg-pan-zoom + init code)
87+
│ ├── css/
88+
│ │ └── app.css Compiled SCSS stylesheet
89+
│ └── font/ Custom icon font (interactive-map)
90+
├── src/
91+
│ ├── js/
92+
│ │ ├── _entry.js Webpack entry point
93+
│ │ ├── popper.min.js Vendored Popper.js
94+
│ │ ├── svg-pan-zoom.min.js
95+
│ │ └── tippy.min.js
96+
│ └── scss/ SCSS source files
97+
│ ├── _entry.scss Entry point — imports all partials
98+
│ ├── style.scss Map colours, layout, typography
99+
│ ├── breadcrumb.scss Breadcrumb navigation styles
100+
│ └── icons-map.scss Icon font @font-face + classes
101+
├── webpack.config.js Webpack bundler configuration
102+
├── package.json Build scripts, dependencies, devDependencies
103+
└── .gitignore
57104
```
58105

59106
## Styling
60107

61-
Map colours are controlled via CSS custom properties in `css/style.css`:
108+
Map colours are controlled via CSS custom properties defined in `src/scss/style.scss` (compiled to `dist/css/app.css`):
62109

63110
| Variable | Default | Purpose |
64111
|----------|---------|---------|
112+
| `--bg-color` | `#d1d3be` | Page background |
65113
| `--color-active` | `#a8a965` | Fill colour of regions |
66114
| `--color-hover` | `#5f6035` | Hover colour |
67115
| `--color-stroke` | `black` | Stroke outline colour |
68116

117+
### Rebuilding CSS
118+
119+
```bash
120+
npm run css-dev # watch mode, expanded output
121+
npm run css-prod # watch mode, compressed output
122+
```
123+
69124
## Map Version
70125

71126
Maps are based on the 2022-2023 delimitation exercise.

bulawayo.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,6 @@ <h3>Provinces are constituent political entities of Zimbabwe. Zimbabwe currently
235235
</div>
236236
</main>
237237

238-
<script src='./dist/js/popper.min.js'></script>
239-
<script src='./dist/js/tippy.min.js'></script>
240-
<script src='./dist/js/svg-pan-zoom.min.js'></script>
241-
<script src="./dist/js/script.js"></script>
238+
<script src="./dist/js/app.js"></script>
242239
</body>
243240
</html>

dist/api/zim_facts.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Zimbabwe Facts
2+
3+
## Coat of arms of Zimbabwe
4+
The coat of arms of Zimbabwe was adopted on 21 September 1981, one year and five months after the national flag was adopted. Previously the coat of arms of Zimbabwe was identical to the former coat of arms of Rhodesia.
5+
6+
## Meanings
7+
8+
The official symbolism of the Zimbabwean coat of arms is as follows:
9+
10+
- **Kudus**: the unity of purpose of Zimbabwe's various ethnic groups; the kudus are "a harmonious blend of black, white and brown".
11+
- **Earth mound**: the plants from which food and clothing is obtained.
12+
- Motto: the need to maintain the desire for national unity and the will to work for the preservation of freedom.
13+
- Green shield: the fertility of the country's soil and water. Blue and white wavy lines symbolise prosperity-bringing water.
14+
- Great Zimbabwe: the historical heritage of Zimbabwe.
15+
- Hoe and Rifle: the transition from war to peace.
16+
- Wreath of gold and green: the mining and agricultural enterprise which "protects our national economy".
17+
- Star: ancient symbol of hope for the future. Tinctured red to "remind us of the suffering of all our people and the need to avoid any recurrence of that suffering".
18+
- Great Zimbabwe Bird: distinctive national emblem.

dist/css/app.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/font/Icon List Source.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Fontello - Typicons v2.0.2
2+
- minus
3+
- plus
4+
- refresh

dist/font/interactive-map.eot

6.17 KB
Binary file not shown.

dist/font/interactive-map.svg

Lines changed: 16 additions & 0 deletions
Loading

dist/font/interactive-map.ttf

5.98 KB
Binary file not shown.

dist/font/interactive-map.woff

3.41 KB
Binary file not shown.

0 commit comments

Comments
 (0)