Styling Rocket template engine

Is it not possible to style Rocket tera or handlebar template engine using external css.

I'm my case I have the following directory setup

I want to be able to use style.css in index.html.tera

Repository link :link:

If rocket is setup to also serve static files from a directory, the path in the href property should be relative to that directory, not to the template file.

See the doc here: StaticFiles in rocket_contrib::serve - Rust

1 Like

I retired I'm getting the following error

What can I do

As the error message says, the version of Rocket you are using requires a nightly version of Rust (this is because it uses unstable features). You should probably upgrade to Rocket 0.5-rc, which supports stable Rust.

Im using v0.5rc

Ah, I see the problem! rocket_contrib only works with Rocket 0.4, and has been replaced with more fine-grained crates going forward.

Template support for 0.5 lives in rocket_dyn_templates, and static file support is now part of the main rocket crate: FileServer in rocket::fs - Rust

Thank you :blush:
I'll check that out

Also I need to connect with MySQL via diesel I don't know if there's a new crate to do this other

For Rocket 0.5, Diesel is integrated via rocket_sync_db_pools.

1 Like

I was able to get the template engine play nicely in development. But I'm getting the following error in production

Here's my source