Created
June 17, 2014 13:43
-
-
Save alco/4702047277b765bc89be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
Options | |
All functions in this module accepts EEx-related options. They are: | |
• :line - the line to be used as the template start. Defaults to 1. | |
• :file - the file to be used in the template. Defaults to the given | |
file the template is read from or to "nofile" when compiling | |
from a string. | |
• :engine - the EEx engine to be used for compilation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
## Options | |
All functions in this module accepts EEx-related options. | |
They are: | |
* `:line` - the line to be used as the template start. Defaults to 1. | |
* `:file` - the file to be used in the template. Defaults to the given | |
file the template is read from or to "nofile" when compiling | |
from a string. | |
* `:engine` - the EEx engine to be used for compilation. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment