Skip to content

Instantly share code, notes, and snippets.

@alco
Created December 28, 2014 19:58
Show Gist options
  • Save alco/4207ba8d61e734a6c2a4 to your computer and use it in GitHub Desktop.
Save alco/4207ba8d61e734a6c2a4 to your computer and use it in GitHub Desktop.
## API
This module provides 3 main APIs for you to use:
1. Evaluate a string (`eval_string`) or a file (`eval_file`)
directly. This is the simplest API to use but also the
slowest, since the code is evaluated and not compiled before.
2. Define a function from a string (`function_from_string`)
or a file (`function_from_file`). This allows you to embed
the template as a function inside a module which will then
be compiled. This is the preferred API if you have access
to the template at compilation time.
3. Compile a string (`compile_string`) or a file (`compile_file`)
into Elixir syntax tree. This is the API used by both functions
above and is available to you if you want to provide your own
ways of handling the compiled template.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment