Simplates

Simplates are a file format for server-side web programming.

Why Simplates?

Mixing code into templates leads to unmaintainable spaghetti. On the other hand, putting closely-related templates and code in completely separate subdirectories makes it painful to switch back and forth.

Simplates improve web development by bringing code and templates as close together as possible, without mixing them.

We're using simplates successfully in Aspen, the web framework behind Gratipay. We like the pattern. It works for us. Can it also work for other teams using other languages and templating systems and web frameworks? Let's find out. :-)

What Does a Simplate Look Like?

Here's an example:

import random

[----]
program = request.qs['program']
excitement = "!" * random.randint(1, 10)

[----] text/html via stdlib_format
<h1>Greetings, {program}{excitement}</h1>

[----] text/plain via stdlib_format
Greetings, {program}{excitement}

[----] application/json via json_dump
{ "program": program
, "excitement": excitement
 }

Implementations and Tools

Fork me on GitHub

Similar Formats

Feedback? Questions?

Start a conversation on GitHub.