Struct slime::Slime
[−]
[src]
pub struct Slime<'a> { /* fields omitted */ }
Rust library for fast prototyping and creating static websites. Use handlebars to handle html parts. Uses json and toml formats for data passed into templates. Flexible design allows to create any type of static website. Creating new project: Create new binary crate with
cargo new --bin crate_name
Open crate folder and run curl -s https://raw.githubusercontent.com/jaroslaw-weber/slime/master/init_slime.sh | bash This will download deployment scripts and create some folders. It will also create example files. Wrapper for creating a static websites. Load templates and helps with loading and inserting data into templates.
Methods
impl<'a> Slime<'a>
[src]
pub fn new(config: Config<'a>) -> Slime<'a>
[src]
Create new wrapper with custom config.
pub fn initialize(&mut self) -> Result<(), Error>
[src]
Load templates (need to run only once)
pub fn load_json_data(&self, file_name: &str) -> Result<SerdeJson, Error>
[src]
Load json data from data folder. Default file extension is ".json" if not specified.
pub fn load_toml_data(&self, file_name: &str) -> Result<Toml, Error>
[src]
Load toml data from data folder. Default file extension is ".toml" if not specified.
pub fn generate<T: Serialize>(
&self,
template: &str,
file_name: &str,
data: &T
) -> Result<(), Error>
[src]
&self,
template: &str,
file_name: &str,
data: &T
) -> Result<(), Error>
Generate file. If filename has no extension then default extension is added (.html)