Curly

screenshot of Curly

The Curly template language allows separating your logic from the structure of your HTML templates.

Overview

Curly is a template language that separates structure and logic by moving all logic to a presenter class. Instead of mixing HTML with Ruby code, Curly allows you to use components in your views and partials that are populated by presenter classes. This makes your code cleaner and easier to maintain.

Features

  • Completely separates structure and logic
  • Uses presenter classes to populate components in views and partials
  • Components are surrounded by curly brackets, e.g. {{hello}}
  • Supports conditional blocks using methods ending in a question mark, e.g. {{#admin?}} ... {{/admin?}}
  • Components can specify identifiers using dot notation, e.g. {{x.y.z}}
  • Components can have attributes using key-value pairs, e.g. {{component attribute="value"}}
  • Supports default values for attributes and arbitrary keyword arguments in presenter methods

Summary

Curly is a template language that simplifies the separation of structure and logic in your views and partials. By using presenter classes to populate components, you can have cleaner and more maintainable code. Curly also supports conditional blocks, component identifiers, and attributes for more flexibility. Overall, Curly is a powerful tool for improving the organization and readability of your code.