Skip to content
forked from zalando/beard

A lightweight, logicless templating engine, written in Scala and inspired by Mustache

License

Notifications You must be signed in to change notification settings

OpenOlitor/beard

 
 

Repository files navigation

Beard: A Blazing-Fast Template Engine

Build Status

Beard is a logic-less templating engine written in Scala and inspired by Mustache. You can use it out-of-the-box; see the Requirements list below.

What makes Beard powerful:

  • Streaming. As soon as you need to render something, you can stream it to the browser. This provides high user-perceived performance.
  • Speed. We've benchmarked it against other template engines for the JVM, and Beard performed much faster in terms of rendering time. (We invite you to run your own benchmarks to see if you get the same results.) It also uses ANTLR to make template compilation fast.
  • It offers template inheritance.
  • Its simple, beautiful syntax. A la Mustache, it uses only the { and } markers for tags and delimiters.

Here's a code snippet to show you how simply Beard can parse templates:

<html>
  <head>
	<title>{{ the.title }}</title>
  </head>
  <body>
	{{ the.content }}
  </body>
</html>

Requirements

  • Scala 2.12 or 2.13
  • a package manager like sbt or Maven

Installing

If you're using sbt, add this line to your build.sbt file:

libraryDependencies += "de.zalando" %% "beard" % "0.3.1"

resolvers ++= Seq(
  "zalando-maven" at "https://dl.bintray.com/zalando/maven"
)

If you're using Maven, run this:

<repositories>
    <repository>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <id>bintray-maven</id>
        <name>bintray</name>
        <url>https://dl.bintray.com/zalando/maven</url>
    </repository>
</repositories>

<dependency>
    <groupId>de.zalando</groupId>
    <artifactId>beard_2.13</artifactId>
    <version>0.3.1</version>
</dependency>

Binaries are available from bintray

Additional Documentation

We've started a Gitbook for additional docs. There, you'll find more information on:

You can contribute to this documentation here.

Performance Tests

Here is how to run them: sbt "testOnly de.zalando.beard.performance.JadeBenchmark"

Contributing/TODO List

We gladly welcome contributions—just submit a pull request with a short note summarizing briefly (1-2 sentences) what you've done. If you'd like to make a substantial contribution to Beard, we could use your help with these items:

  • adding filters: ind Handlebars, Angular, Twig, etc.
  • providing more meaningful error messages

License

Copyright 2015 Zalando SE

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

A lightweight, logicless templating engine, written in Scala and inspired by Mustache

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 90.0%
  • ANTLR 4.0%
  • HTML 3.3%
  • FreeMarker 1.4%
  • Mustache 0.5%
  • Handlebars 0.5%
  • Pug 0.3%