Injecting CSS into HTML
Injecting CSS takes the same approach as injecting JavaScript. We will have a CSS tag in the HTML file that will be replaced with the CSS from the file. To achieve this, we must carry out the following steps:
- Add CSS tags to our HTML file.
- Create a base CSS file for the whole app.
- Create a CSS file for our main view.
- Update our Rust crate to serve the CSS and JavaScript.
Let’s have a closer look at this process.
Adding CSS tags to HTML
First, let’s make some changes to our templates/main.html file:
<style>
{{BASE_CSS}}
{{CSS}}
</style>
<body>
<div class="mainContainer">
<h1>Done Items</h1>
<div id="doneItems"></div>
<h1>To...