On this page:
Beeswax:   a Pollen-friendly template language
8.9

Beeswax: a Pollen-friendly template language

Joel Dueck <joel@jdueck.net>

 (require beeswax) package: beeswax

Beeswax is a simple templating language. A Beeswax template wraps its contents in a function that can be imported by other modules and applied to data to get a rendered document. Having a #lang for your templates has a few small benefits: it lights up all the little conveniences of your IDE, if you use one (DrRacket, racket-mode, etc.); it’s a little easier to reason about and reuse in other contexts; and it can make renders faster (because the template can be compiled).

Beeswax was designed to be easy to use within Pollen projects, but can be of use in other Racket projects as well.

Warning: Beeswax isn’t done yet, and will probably change. I will announce any breaking changes in the Announcements section of the project’s discussion forum.

Installation: To install Beeswax from the command line:

> raco pkg install beeswax

Or using DrRacket: click the File menu → Install Package ….

    1 Using Beeswax in a Pollen project

      1.1 Beeswax conversion

        1.1.1 Your template is now a module

      1.2 Pollen integration

    2 Beeswax Reference

      2.1 Templates

        2.1.1 Syntax and bindings

        2.1.2 The apply-template function

        2.1.3 Template filename conventions

      2.2 Rendering

      2.3 For Pollen

    3 raco beeswax render

      3.1 Optimizing renders

        3.1.1 Use raco make on your templates

        3.1.2 Example benchmarks

    4 Acknowledgements and License

      4.1 Acknowledgements

      4.2 License and Source Code