trmnlp

A basic self-hosted web server to ease the development and sharing of TRMNL plugins.

Liquid templates are rendered leveraging the TRMNL Design System. They may be generated as HTML (faster, and a good approximation of the final result) or as BMP images (slower, but more accurate).

The server watches the filesystem for changes to the Liquid templates, seamlessly updating the preview without the need to refresh.

Screenshot

Creating a Plugin

This is the structure of a plugin project.

.trmnlp.yml
src/
    full.liquid
    half_horizontal.liquid
    half_vertical.liquid
    quadrant.liquid
    settings.yml

Syncing Plugin With TRMNL Server

trmnl login      # authenticate with TRMNL account
trmnl pull [id]  # download (plugin ID required on first pull only)
trmnl push       # upload

Running the Server (Docker)

docker run \
    -p 4567:4567 \
    -v /path/to/plugin/on/host:/plugin \
    trmnl/trmnlp

Running the Server (Local Ruby)

Prerequisites:

  • Ruby 3.x
  • For BMP rendering (optional):
    • Firefox
    • ImageMagick

In the plugin project:

gem install trmnl_preview
trmnlp serve

./.trmnlp.yml Reference (Project Config)

The .trmnlp.yml file lives in the root of the plugin project, and is for configuring the local dev server.

System environment variables are made available in the {{ env }} Liquid varible in this file only. This can be used to safely supply plugin secrets, like API keys.

All fields are optional.

# {{ env.VARIABLE }} interpolation is available here
---
# auto-reload when files change (`watch: false` to disable)
watch:
  - src
  - .trmnlp.yml

# values of custom fields (defined in src/settings.yml)
custom_fields:
  station: "{{ env.ICAO }}"

# override variables
variables:
  trmnl:
    user:
      name: Peter Quill
    plugin_settings:
      instance_name: Kevin Bacon Facts

./src/settings.yml Reference (Plugin Config)

The settings.yml file is part of the plugin definition.

See TRMNL documentation for details on this file's contents.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/usetrmnl/trmnlp.

License

The gem is available as open source under the terms of the MIT License.