[−][src]Crate rocket_include_handlebars
Include Handlebars Templates for Rocket Framework
This is a crate which provides macros handlebars_resources_initialize!
and handlebars_response!
to statically include HBS (Handlebars) files from your Rust project and make them be the HTTP response sources quickly.
handlebars_resources_initialize!
is used for including HBS files into your executable binary file. You need to specify each file's name and its path. For instance, the above example uses index to represent the file included-handlebars/index.hbs and index-2 to represent the file included-handlebars/index2.hbs. A name cannot be repeating. In order to reduce the compilation time and allow to hot-reload templates, files are compiled into your executable binary file together, only when you are using the release profile.handlebars_response!
is used for retrieving and rendering the file you input through the macrohandlebars_resources_initialize!
as aHandlebarsResponse
instance with rendered HTML. When itsrespond_to
method is called, three HTTP headers, Content-Type, Content-Length and Etag, will be automatically added, and the rendered HTML can optionally be minified.handlebars_response_static!
is used for in-memory staticizing aHandlebarsResponse
instance by a given key. It is effective only when you are using the release profile.
See examples
.
Re-exports
pub extern crate handlebars; |
Macros
handlebars_resources_initialize | Used in the fairing of |
handlebars_response | Used for retrieving and rendering the file you input through the macro |
handlebars_response_static | This macro can be used to wrap a |
Structs
EntityTag | An entity tag, defined in RFC7232 |
EtagIfNoneMatch | The request guard used for getting |
HandlebarsContextManager | To monitor the state of Handlebars. |
HandlebarsResponse | To respond HTML from Handlebars templates. |
ReloadableHandlebars | Reloadable Handlebars. |