mirror of https://github.com/rwf2/Rocket.git
Add details about Template usage in contrib.
This commit is contained in:
parent
be3530bb44
commit
916bf7310a
|
@ -21,7 +21,7 @@
|
|||
//! `Cargo.toml` file, setting `default-features` to false, and specifying
|
||||
//! features manually. For example, to use the JSON module, you would add:
|
||||
//!
|
||||
//! ```rust,ignore
|
||||
//! ```toml,ignore
|
||||
//! [dependencies.rocket_contrib]
|
||||
//! version = "*"
|
||||
//! default-features = false
|
||||
|
|
|
@ -44,9 +44,10 @@ use rocket::http::ContentType;
|
|||
/// right) given that the template is at the path on the left.
|
||||
///
|
||||
/// * `{template_dir}/index.html.hbs` => index
|
||||
/// * `{template_dir}/index.tera` => index
|
||||
/// * `{template_dir}/index.hbs` => index
|
||||
/// * `{template_dir}/dir/index.hbs` => dir/index
|
||||
/// * `{template_dir}/dir/index.html.hbs` => dir/index
|
||||
/// * `{template_dir}/dir/index.html.tera` => dir/index
|
||||
/// * `{template_dir}/index.template.html.hbs` => index.template
|
||||
/// * `{template_dir}/subdir/index.template.html.hbs` => subdir/index.template
|
||||
///
|
||||
|
@ -60,6 +61,19 @@ use rocket::http::ContentType;
|
|||
/// [Serde](https://github.com/serde-rs/json) and would serialize to an `Object`
|
||||
/// value.
|
||||
///
|
||||
/// # Usage
|
||||
///
|
||||
/// To use, add the `handlebars_templates` feature, the `tera_templates`
|
||||
/// feature, or both, to the `rocket_contrib` dependencies section of your
|
||||
/// `Cargo.toml`:
|
||||
///
|
||||
/// ```toml,ignore
|
||||
/// [dependencies.rocket_contrib]
|
||||
/// version = "*"
|
||||
/// default-features = false
|
||||
/// features = ["handlebars_templates", "tera_templates"]
|
||||
/// ```
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// To render a template named "index" with a `HashMap` as the context:
|
||||
|
|
Loading…
Reference in New Issue