-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add --assets usage documentation
- Loading branch information
1 parent
c118d83
commit 03b5a3e
Showing
1 changed file
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,80 @@ Clone the [**linz/basemaps-config**][bm_config_repo] repository to your machine. | |
```bash | ||
$BM_SPRITES_BIN = $BM_REPO/packages/sprites/bin | ||
``` | ||
|
||
## Generate the `basemaps` assets | ||
|
||
### 1. Create local directory | ||
|
||
To prepare for bundling the `basemaps` assets archive, create a local directory on your machine with the following subdirectory structure: | ||
|
||
```md | ||
- assets | ||
- fonts | ||
- sprites | ||
``` | ||
|
||
You can specify a location and directory name of your choice. | ||
|
||
!!! abstract "Path" | ||
|
||
On your machine, consider the following path: | ||
|
||
=== "`ASSETS_DIR`" | ||
|
||
The path to the created directory on your machine. | ||
|
||
```bash | ||
$ASSETS_DIR = {path_to_directory} | ||
``` | ||
|
||
### 2. Convert fonts into `.pbf` (protobuf-encoded glyphs) files | ||
|
||
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. | ||
|
||
Move the generated and/or downloaded collections of `.pbf` files **into** the following directory: | ||
|
||
``` | ||
$ASSETS_DIR/assets/fonts | ||
``` | ||
|
||
The contents of your `$ASSETS_DIR/assets/fonts` directory should look similar to the following: | ||
|
||
```md | ||
- $ASSETS_DIR/assets/fonts | ||
- Noto Sans Bold | ||
- 0-255.pbf | ||
- ... | ||
- Open Sans Bold | ||
- 0-255.pbf | ||
- ... | ||
``` | ||
|
||
### 3. Convert sprite files into sprite sheets | ||
|
||
Use the following command to generate the `basemaps` sprite sheets from the collection of topographic sprite files: | ||
|
||
```bash | ||
node $BM_SPRITES_BIN/basemaps-sprites.mjs \ | ||
$BM_CONFIG_REPO/config/sprites/topographic | ||
``` | ||
|
||
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: | ||
|
||
```md | ||
$ASSETS_DIR/assets/sprites | ||
``` | ||
|
||
The contents of your `$ASSETS_DIR/assets/sprites` directory should look similar to the following: | ||
|
||
```md | ||
- $ASSETS_DIR/assets/sprites | ||
- topographic.json | ||
- topographic.png | ||
- [email protected] | ||
- [email protected] | ||
``` | ||
|
||
## Run the `basemaps/cli` package | ||
|
||
### Command | ||
|
@@ -63,15 +137,15 @@ Use the following command to bundle the `basemaps` assets archive: | |
|
||
```bash | ||
node $BM_CLI_BUILD/bin.js bundle-assets \ | ||
--assets $BM_CONFIG_REPO/assets \ | ||
--assets $ASSETS_DIR \ | ||
--output assets.bundle.tar.co \ | ||
``` | ||
|
||
### Parameters | ||
|
||
=== "`--assets`" | ||
|
||
Specifies the location of the assets folder to use. This folder refers to that of which is within the `basemaps-config` repository. | ||
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. | ||
|
||
=== "`--output`" | ||
|
||
|
@@ -80,3 +154,5 @@ node $BM_CLI_BUILD/bin.js bundle-assets \ | |
<!-- external links --> | ||
|
||
[bm_config_repo]: https://github.com/linz/basemaps-config | ||
[fonts_readme]: https://github.com/linz/basemaps-config/tree/master/config/fonts | ||
[pbf_fonts_repo]: https://github.com/korywka/fonts.pbf |