This feature would be required to allow strings embedded in the program (specifically like in https://github.com/SergioBenitez/Rocket/issues/227) to be used as templates.
Currently rocket_contrib::Template only supports templates which exist on the real file system.
This feature could exist outside of rocket, by just using the template engine directly and passing in the template string and context. However, this feature may still make sense in rocket_contrib to remove boilerplate from the common desire to embed static files in the executable.
This feature may also be solved by or related to implementing https://github.com/SergioBenitez/Rocket/issues/64.
Issue was labelled as idea instead of request, mostly because I'm looking for input and less certain about what shape the ideal solution will be in.
What about using https://maud.lambda.xyz?
I think this is a good idea. Right now, e.g. Maud can already work with Rocket (see the maud documentation), as when Maud's rocket feature is enabled, an impl of the Responder trait is generated for maud HTML. Of course, that means skipping the template layer, and calling Maud's functionality in-line.
Being able to wrap with the Template type would allow for a cleaner separation of concerns.
This would be very nice.
Distributing the templates when deploying the binary is quite annoying.
Diesel has an embed_migrations!("the/path") macro to load migrations from the file system at compile time and embed them into the code.
That would be pretty awesome.
https://github.com/SergioBenitez/Rocket/pull/521 will land shortly and make this possible!
Most helpful comment
This would be very nice.
Distributing the templates when deploying the binary is quite annoying.
Diesel has an
embed_migrations!("the/path")macro to load migrations from the file system at compile time and embed them into the code.That would be pretty awesome.