Skip to content

Squarespace/template-compiler

Repository files navigation

Squarespace Template Compiler.

A Java template compiler based on JSON-Template.

Build Status Coverage Status

License: Apache 2.0 (summary)

Copyright (c) 2014 SQUARESPACE, Inc.

Overview

Squarespace's template language is based on JSON-Template, a minimal declarative template language for Python and JavaScript, heavily influenced by google-ctemplate.

Objectives

The project was started with these objectives:

  • Move away from using Node.js for backend template compilation.
  • Must meet or exceed performance of the legacy system. The compiler can potentially execute several times for each page view, so it needs to be really fast.
  • Improve performance over the legacy system.
  • Minimize memory usage. For example, parsing can often create and discard a high number of temporary strings.
  • Support additional features for server-side compilation.
  • High test coverage.
  • Support syntax error recovery.
  • Support a template validation mode.

Measured Results

  • Average 20x performance increase over previous Node.js + JSON-Template system.