Skip to content

Commit 03b5a3e

Browse files
docs: add --assets usage documentation
1 parent c118d83 commit 03b5a3e

File tree

1 file changed

+78
-2
lines changed

1 file changed

+78
-2
lines changed

docs/developer-guide/cli-methods/bundle-the-basemaps-assets-archive.md

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,80 @@ Clone the [**linz/basemaps-config**][bm_config_repo] repository to your machine.
5555
```bash
5656
$BM_SPRITES_BIN = $BM_REPO/packages/sprites/bin
5757
```
58+
59+
## Generate the `basemaps` assets
60+
61+
### 1. Create local directory
62+
63+
To prepare for bundling the `basemaps` assets archive, create a local directory on your machine with the following subdirectory structure:
64+
65+
```md
66+
- assets
67+
- fonts
68+
- sprites
69+
```
70+
71+
You can specify a location and directory name of your choice.
72+
73+
!!! abstract "Path"
74+
75+
On your machine, consider the following path:
76+
77+
=== "`ASSETS_DIR`"
78+
79+
The path to the created directory on your machine.
80+
81+
```bash
82+
$ASSETS_DIR = {path_to_directory}
83+
```
84+
85+
### 2. Convert fonts into `.pbf` (protobuf-encoded glyphs) files
86+
87+
To generate the `basemaps` `.pbf` files, follow the instructions described in this [README.md][fonts_readme] file. Alternatively, there is a [repository][pbf_fonts_repo] containing various fonts that have already been converted into the `.pbf` format.
88+
89+
Move the generated and/or downloaded collections of `.pbf` files **into** the following directory:
90+
91+
```
92+
$ASSETS_DIR/assets/fonts
93+
```
94+
95+
The contents of your `$ASSETS_DIR/assets/fonts` directory should look similar to the following:
96+
97+
```md
98+
- $ASSETS_DIR/assets/fonts
99+
- Noto Sans Bold
100+
- 0-255.pbf
101+
- ...
102+
- Open Sans Bold
103+
- 0-255.pbf
104+
- ...
105+
```
106+
107+
### 3. Convert sprite files into sprite sheets
108+
109+
Use the following command to generate the `basemaps` sprite sheets from the collection of topographic sprite files:
110+
111+
```bash
112+
node $BM_SPRITES_BIN/basemaps-sprites.mjs \
113+
$BM_CONFIG_REPO/config/sprites/topographic
114+
```
115+
116+
The above command will output the resulting sprite sheets to the location from which you executed the command. Move the outputted files **into** the following directory:
117+
118+
```md
119+
$ASSETS_DIR/assets/sprites
120+
```
121+
122+
The contents of your `$ASSETS_DIR/assets/sprites` directory should look similar to the following:
123+
124+
```md
125+
- $ASSETS_DIR/assets/sprites
126+
- topographic.json
127+
- topographic.png
128+
- topographic@2x.json
129+
- topographic@2x.png
130+
```
131+
58132
## Run the `basemaps/cli` package
59133

60134
### Command
@@ -63,15 +137,15 @@ Use the following command to bundle the `basemaps` assets archive:
63137

64138
```bash
65139
node $BM_CLI_BUILD/bin.js bundle-assets \
66-
--assets $BM_CONFIG_REPO/assets \
140+
--assets $ASSETS_DIR \
67141
--output assets.bundle.tar.co \
68142
```
69143

70144
### Parameters
71145

72146
=== "`--assets`"
73147

74-
Specifies the location of the assets folder to use. This folder refers to that of which is within the `basemaps-config` repository.
148+
Specifies the location of the assets folder to use. This folder refers to that which contains the `.pbf` files and sprite sheets on your local machine.
75149

76150
=== "`--output`"
77151

@@ -80,3 +154,5 @@ node $BM_CLI_BUILD/bin.js bundle-assets \
80154
<!-- external links -->
81155

82156
[bm_config_repo]: https://github.com/linz/basemaps-config
157+
[fonts_readme]: https://github.com/linz/basemaps-config/tree/master/config/fonts
158+
[pbf_fonts_repo]: https://github.com/korywka/fonts.pbf

0 commit comments

Comments
 (0)