Skip to content

LighTemplate is a tiny, idiomatic and fast HTML Template engine.

License

Notifications You must be signed in to change notification settings

apfeltee/lightemplate-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LighTemplate is a tiny library abstraction for ERB-like HTML templates.

Usage for lightemplate-ruby:

require "lightemplate"

tpl = LighTemplate.new("Hello, <%=name%>!")

# prints the generated code
puts tpl.code

# prints the result of executing the generated code
puts tpl.exec({name: "world"})

A helper function to work with files quick and easy exists as well:

puts LighTemplate.file("something.rhtml", mybinding)

which is the same as:

puts LighTemplate.new(File.read("something.rhtml")).exec(mybinding)

You can pass classic Binding objects, or OpenStruct and Hashes to #exec.


LighTemplate should work just fine with mruby, because it does not use any regular expressions. More testing is needed!

About

LighTemplate is a tiny, idiomatic and fast HTML Template engine.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published