Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

relative template paths and include_str support #877

@henke443

Description

@henke443

I would want to have the feature.html template be in the same folder as feature.rs.

It would be cool if you could do either one of:

A)

pub static FEATURE_TEMPLATE_HTML: &'static str = include_str!("feature.html");

#[derive(Template)]
#[template(source=FEATURE_TEMPLATE_HTML, ext = "html")] 
struct featureTemplate<'a> { 
    name: &'a str,
}

B)

#[derive(Template)] 
#[template(path="./feature.html")]  // And maybe just path="feature.html" is using the toml dirs? Like how "import" works in nodejs
struct featureTemplate<'a> { 
    name: &'a str, 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions