0.0
The project is in a healthy, maintained state
Automatically rebuild and preview TRNML plugins in multiple views
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 5.6
~> 6.5
~> 2.2
~> 4.1
~> 3.0
~> 0.16
~> 4.12.0
 Project Readme

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 repository.

views/
    full.liquid
    half_horizontal.liquid
    half_vertical.liquid
    quadrant.liquid
config.toml

See config.example.toml for an example config.

The trmnl-hello repository is provided as a jumping-off point for creating new plugins. Simply fork the repo, clone it, and start hacking.

Running the Server (Docker)

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

Running the Server (Local Ruby)

Prerequisites:

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

In the plugin repository:

gem install trmnl_preview
trmnlp serve                # Starts the server

Usage Notes

When the strategy is "polling", the specified URL will be fetched once, when the server starts.

When the strategy is "webhook", payloads can be POSTed to the /webhook endpoint. They are saved to tmp/data.json for future renders.

config.toml Reference

  • strategy - Either "polling" or "webhook"
  • url - The URL from which to fetch JSON data (polling strategy only)
  • live_render - Set to false to disable automatic rendering when Liquid templates change (default true)
  • [polling_headers] - A section of headers to append to the HTTP poll request (polling strategy only)

Contributing

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

License

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