-
Pre-requisites
- Docker must be installed. This is used to run a martin tile server image, which is the one that converts source files to sprites.
- Python 3 must be installed. It's used by
scripts/round_svg_numbers.py(see step 2 below) and bygenerate_sprites.sh, which usesscripts/strip_stretchable_markers.pyto strip the stretchable-icon marker fills (content/stretchX/stretchY) out of the SVGs before martin sees them. No extra packages needed - both only use the standard library.
-
Make sure that the assets in
sprite_assetsare correct.
It is essential that the file names are correct.
For each folder (= OMS partner), there should be two folders –lightanddark. Then follow the same patterns as used in the app. Remember - all svgs should have a theme suffix ->lightordark. -
Round the SVGs before committing. Figma re-exports the same, unchanged design with slightly different floating point noise every time (e.g.
20.4598one export,20.4594the next), which makes every touched SVG show up as modified even when nothing actually changed. Run this after exporting from Figma and before committing:python3 scripts/round_svg_numbers.py sprite_assets
This rounds every numeric value (path data, coordinates, transforms, ...) to 2 decimal places directly in the SVG files - well below one pixel at these icon sizes, so it has no visible effect, but it means two exports of the same design produce an identical diff-free file. Files that need no changes are left untouched.
-
Generate sprites
bash generate_sprites.sh
After the run completes, the updated sprites should be available inside the
generated_spritesfolder.You can also pass one or more namespace names to only regenerate specific orgs:
bash generate_sprites.sh AtB FRAM
CI: When a pull request touches files under
sprite_assets/orscripts/, GitHub Actions runs the script tests, then (ifsprite_assets/changed) regenerates sprites for the changed namespaces and commits the result back to the PR branch. No manual script run needed.
Running the script tests locally:
python3 -m unittest discover scripts-
Upload sprites to GCS
Pre-requisites:
gcloudCLI installed and authenticated:gcloud auth application-default login- Your account needs
roles/storage.objectAdminon the target*--shared-assetsbuckets.
bash upload_sprites.sh staging # upload to all staging buckets bash upload_sprites.sh prod # upload to all prod buckets
Each run:
- Bumps the version automatically (reads last version from
uploads.md, increments) - Uploads all six tenants (AtB, Troms, NFK, FRAM, VKT, Farte) to the new
vNpath in their respective GCS buckets - Commits the new
uploads.mdrow and pushes an annotated git tagupload/<env>/v<N>
After uploading, open a PR in
firestore-configurationto point themapboxSpriteUrlsfor the relevant tenants at the new version path.