Remove custom CSS-inlining HEAD

This commit is contained in:
Aarni Koskela
2022-02-11 15:34:02 +02:00
parent b03519ec5f
commit 331b3d07d0

View File

@@ -3,26 +3,6 @@ import Document, { Html, Head, Main, NextScript } from "next/document";
import { Footer } from "../components/Footer";
import Fader from "../components/Fader";
import ReactGA from "react-ga";
import fs from "fs";
import path from "path";
class CustomNextHead extends Head {
// TODO: This might not be needed if Next.js implements built-in support
// https://github.com/zeit/next-plugins/issues/364
getCssLinks({ allFiles }) {
return allFiles
.filter((file) => file.endsWith(".css"))
.map((file) => (
<style
key={file}
nonce={this.props.nonce}
dangerouslySetInnerHTML={{
__html: fs.readFileSync(path.join(".next", file), "utf-8"),
}}
/>
));
}
}
function trackPageView() {
if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
@@ -49,7 +29,7 @@ class MyDocument extends Document {
render() {
return (
<Html lang="fi">
<CustomNextHead />
<Head />
<body>
<div className="site">
<div className="container">