Browse Source

feat: inline all initial CSS in HTML

pull/2/head
Muthu Kumar 11 months ago
parent
commit
a3a2bc4572
Failed to extract signature
  1. 10
      index.html
  2. 1
      src/index.tsx
  3. 3
      src/util/index.ts
  4. 1
      tsconfig.json

10
index.html

@ -17,15 +17,19 @@
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
<meta name="msapplication-config" content="/favicon/browserconfig.xml"> <meta name="msapplication-config" content="/favicon/browserconfig.xml">
<meta name="msapplication-TileColor" content="#ff5555"> <meta name="msapplication-TileColor" content="#ff5555">
<link rel="stylesheet" href="/fonts.css" />
<title>MKRhere</title> <title>MKRhere</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<style>
/* inline all the CSS to save a couple roundtrips */
@import url('./src/index.css');
@import url('./public/fonts.css');
@import url('./src/util/dynamic-gradient.css');
</style>
<div id="root"></div> <div id="root"></div>
<script type="module" src="/src/index.tsx"></script> <script type="module" src="/src/index.tsx"></script>
</body> </body>
</html> </html>

1
src/index.tsx

@ -1,7 +1,6 @@
import React from "react"; import React from "react";
import { createRoot } from "react-dom/client"; import { createRoot } from "react-dom/client";
import "./index.css";
import useLocation from "wouter/use-location"; import useLocation from "wouter/use-location";

3
src/util/index.ts

@ -56,8 +56,7 @@ export const get = {
}, },
}; };
import "./dynamic-gradient.css"; // required css is inlined in index.html
export function setupCursorTracking(el: HTMLElement | null) { export function setupCursorTracking(el: HTMLElement | null) {
if (!el) return; if (!el) return;

1
tsconfig.json

@ -6,6 +6,7 @@
"skipLibCheck": false, "skipLibCheck": false,
"esModuleInterop": false, "esModuleInterop": false,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"allowImportingTsExtensions": true,
"strict": true, "strict": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"module": "ESNext", "module": "ESNext",

Loading…
Cancel
Save