Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Hamlit | 976 | 1,804 | 14 | 2 months ago | 117 | February 03, 2022 | other | Ruby | ||
High Performance Haml Implementation | ||||||||||
Sinatra Partial | 105 | 735 | 20 | 6 years ago | 11 | July 28, 2017 | 3 | other | Ruby | |
Just the partials helper in a gem. That is all. | ||||||||||
Sinatra Prawn | 46 | 2 | 11 years ago | 3 | August 10, 2014 | 5 | mit | Ruby | ||
Sinatra extension to add support for pdf rendering with Prawn templates. | ||||||||||
React Sinatra | 37 | 5 years ago | 2 | January 19, 2017 | 1 | mit | Ruby | |||
React on Sinatra Integration, Server Side Rendering | ||||||||||
Tilt Jbuilder | 22 | 462 | 6 | 6 years ago | 12 | January 30, 2016 | 3 | mit | Ruby | |
Support for rendering Jbuilder templates in Tilt | ||||||||||
Sinatra Markaby | 9 | 14 years ago | 3 | August 10, 2014 | 1 | mit | Ruby | |||
Sinatra plugin to enable markaby (.mab) template rendering | ||||||||||
Cells Sinatra | 9 | 13 years ago | Ruby | |||||||
View Components for Sinatra. | ||||||||||
Ruby Oc | 5 | 3 | 1 | 7 years ago | 5 | November 10, 2015 | 2 | mit | Ruby | |
OpenComponents for Ruby | ||||||||||
Tumblr Dashboard Rss Sinatra App | 5 | 12 years ago | Ruby | |||||||
Sinatra application for rendering tumblr dashboard rss | ||||||||||
Chuck Renderer | 4 | 6 years ago | 2 | gpl-3.0 | CSS | |||||
Docker image for ChucK rendering as a service |
Hamlit is a high performance Haml implementation.
Hamlit's implementation was copied to Haml 6. From Haml 6, you don't need to switch to Hamlit.
Both Haml 6 and Hamlit are still maintained by k0kubun. While you don't need to immediately deprecate Hamlit, Haml 6 has more maintainers and you'd better start a new project with Haml rather than Hamlit, given no performance difference between them.
Hamlit is another implementation of Haml. With some Hamlit's characteristics for performance, Hamlit is 1.94x times faster than the original Haml 5 in this benchmark, which is an HTML-escaped version of slim-template/slim's one for fairness. (Result on Travis)
hamlit v2.13.0: 247404.4 i/s
erubi v1.9.0: 244356.4 i/s - 1.01x slower
slim v4.1.0: 238254.3 i/s - 1.04x slower
faml v0.8.1: 197293.2 i/s - 1.25x slower
haml v5.2.0: 127834.4 i/s - 1.94x slower
As written in Hamlit's characteristics, Hamlit drops some not-so-important features which require works on runtime. With the optimized language design, we can reduce the string concatenation to build attributes.
Hamlit analyzes Ruby expressions with Ripper and render it on compilation if the expression is static. And Hamlit can also compile string literal with string interpolation to reduce string allocation and concatenation on runtime.
While Hamlit has static analyzer and static attributes are rendered on compilation, dynamic attributes must be rendered on runtime. So Hamlit optimizes rendering on runtime with C extension.
See REFERENCE.md for details.
Add this line to your application's Gemfile or just replace gem "haml"
with gem "hamlit"
.
It enables rendering by Hamlit for *.haml automatically.
gem 'hamlit'
If you want to use view generator, consider using hamlit-rails.
Replace gem "haml"
with gem "hamlit"
in Gemfile, and require "hamlit".
While Haml disables escape_html
option by default, Hamlit enables it for security.
If you want to disable it, please write:
set :haml, { escape_html: false }
You can see compiled code or rendering result with "hamlit" command.
$ gem install hamlit
$ hamlit --help
Commands:
hamlit compile HAML # Show compile result
hamlit help [COMMAND] # Describe available commands or one specific command
hamlit parse HAML # Show parse result
hamlit render HAML # Render haml template
hamlit temple HAML # Show temple intermediate expression
$ cat in.haml
- user_id = 123
%a{ href: "/users/#{user_id}" }
# Show compiled code
$ hamlit compile in.haml
_buf = []; user_id = 123;
; _buf << ("<a href='/users/".freeze); _buf << (::Hamlit::Utils.escape_html((user_id))); _buf << ("'></a>\n".freeze); _buf = _buf.join
# Render html
$ hamlit render in.haml
<a href='/users/123'></a>
Please report an issue with following information:
Please follow the existing coding styles and do not send patches including cosmetic changes.
Copyright (c) 2015 Takashi Kokubun