Moved inlining of CSS to server side IO-424

This commit is contained in:
Patrick Fic
2020-12-08 11:15:29 -08:00
parent 79910f6725
commit bb8343f966
8 changed files with 607 additions and 547 deletions

View File

@@ -0,0 +1,23 @@
const path = require("path");
require("dotenv").config({
path: path.resolve(
process.cwd(),
`.env.${process.env.NODE_ENV || "development"}`
),
});
const inlineCssTool = require("inline-css");
exports.inlinecss = (req, res) => {
//Perform request validation
console.log("[CSS] New Inline CSS Request.");
const { html, url } = req.body;
inlineCssTool(html, { url: url })
.then((inlinedHtml) => {
res.send(inlinedHtml);
})
.catch((error) => res.send(error));
};