Files
bodyshop/server/render/inlinecss.js
2020-12-08 11:15:29 -08:00

24 lines
502 B
JavaScript

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));
};