To require file as string with Node.js, we call readFileSync
.
For instance, we write
import fs from "fs";
import path from "path";
const css = fs.readFileSync(path.resolve(__dirname, "email.css"), "utf8");
to read the email.css file into a string with the readFileSync
method.