Skip to content

Use local file as theme #331

@Lenormju

Description

@Lenormju

Description

Add support for providing theme by a file.

The !include keyword allows for 3 different types of resources : !include <file|directory|url>
While the theme keyword allows for only 1 type of resource : theme <default|url> (default being a shorthand for an hardcoded URL).

I was uncertain between the Priority "no rush" and "willing to open a PR". I think I can solve this issue myself, but I'd like to know if you are okay with the goal before to start working on it.

Priority

I'm willing to add this feature myself and raise a PR (please confirm approach first)

More information

I don't want to have to store my own theme file on a file server somewhere, to be picked up by Structurizr, while it can already use local files for all kinds of purposes.
I had to use Docker Compose with a Python Simple HTTP Server to be able to have a self-contained build step :

name: build-structurizr
services:
  serve-theme:
    image: "python:3.10.8-slim-bullseye"
    working_dir: /www/data/
    command: "python -m http.server 8000"
    ports:
      - 8000:8000
    volumes:
      - type: bind
        source: ./docs/theme/
        target: /www/data/
        read_only: true

  build-docs:
    image: ghcr.io/avisi-cloud/structurizr-site-generatr:latest
    command: generate-site -w workspace.dsl
    volumes:
      - type: bind
        source: ./docs/
        target: /var/model/
        read_only: false
    depends_on:
      - serve-theme

which made possible to provide the theme as an URL :

        theme http://serve-theme:8000/theme.json

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions