How to use templates in Tauri? #14933
-
|
Template engines such as EJS and Mustache work great when you making a website with NodeJS and Express for example. However there is no backend (except for Rust) for Tauri. How does one render pages in the Tauri app with Template engines effectively? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I found a way to achieve this using And with using a client side router like Navigo, you can turn a client side JS script into a router, which allows you to execute code when a user goes to a certain page/url in the app. The code you will execute is the template rendering itself |
Beta Was this translation helpful? Give feedback.
I found a way to achieve this using
fetch()to simply fetch the template files in thesrc/directory of the app, for example to fetchsrc/index.html, you can simply usefetch('index.html').And with using a client side router like Navigo, you can turn a client side JS script into a router, which allows you to execute code when a user goes to a certain page/url in the app. The code you will execute is the template rendering itself