freedit needs to be restarted every time the css style is modified to see the effect, is there any other way to solve this problem?

โš“ Dev    ๐Ÿ“… 2023-06-24    ๐Ÿ‘ค Ryza    ๐Ÿ‘๏ธ 185      

Ryza

Warning

This post was published 95 days ago. The infomation described in this article may have changed.

If it is just a modification of the elements and css in the html, it must be recompiled is there any way to solve this problem? @freedit

๐Ÿท๏ธ freedit

freedit    2023-06-24 ๐Ÿ‘ ๐Ÿ‘Ž

Cargo watch https://github.com/watchexec/cargo-watch might be helpful but itโ€™s not easy to solve it unless we replace askama

1

freedit    2023-06-25 ๐Ÿ‘ ๐Ÿ‘Ž

There is another way:

just add

 let mut router_static = Router::new()
        .route("/static/style.css", get(style))
        .nest_service("/static/avatars", ServeDir::new(&CONFIG.avatars_path))
        .nest_service("/static/inn_icons", ServeDir::new(&CONFIG.inn_icons_path))
        .nest_service("/static/upload", ServeDir::new(&CONFIG.upload_path))
        .nest_service("/css", ServeDir::new("./static/css"));

https://github.com/freedit-org/freedit/blob/1c6df951556e2c870ee58294973b115337f965f1/src/app_router.rs#L109-L113

And then you will get /css/main.css in static css folder.

3

freedit    2023-06-25 ๐Ÿ‘ ๐Ÿ‘Ž

We bundled css files in binary so the instance maintainers donโ€™t have to get these static files. We prefer easy to deploy than easy to develop.

4