Inserting Styles with CSS
We are going to insert CSS by defining a CSS next to our index.tsx
file and declaring it in our HTML file so that the CSS is requested by the frontend and served. We also need to bundle our CSS. First, we import the CSS in our index.tsx
file with the following code:
// File: ingress/frontend/src/index.tsx
import "./App.css";
This ensures that we will also create a bundle.css
file in the public directory when creating a frontend build. Now inside our HTML file in the public directory, we have the following:
<!-- File: ingress/frontend/public/index.html -->
<!DOCTYPE html>
<html>
<head>
<title>My React App</title>
</head>
<body>
<div id="root"></div>
<link rel="stylesheet" href="./bundle.css">
<script type="module" src="./bundle.js"></script>
</body>
</html>
For our ingress...