mddub / urchin-cgm

A graph of your CGM data on a Pebble watch.
MIT License
56 stars 45 forks source link

Make config page available offline #54

Closed mddub closed 7 years ago

mddub commented 7 years ago

This change marks the end of hosting the configuration page on GitHub Pages.

A Pebble configuration page is an HTML document shown in a webview in the Pebble app. The JS must provide a URL to this document. Traditionally, the page is hosted on a server (in Urchin's case, on GitHub Pages), and the current settings are passed by adding to the URL's hash or query string.

With this change, the entire HTML document for the config page is represented as a data URI, with the current settings substituted for placeholder strings within the page contents. This brings a few advantages:

This change adds build steps to inline JS, CSS, and images in the config HTML, minify the result, and make it available to the PebbleKit JS app. (Pebble's new Clay framework uses a similar process.) To aid development, the config page can still be viewed un-inlined by passing BUILD_ENV=development to pebble build.

bewest commented 7 years ago

Brilliant execution. :+1: Otherwise known as elegant hack.