Moved inlining of CSS to server side IO-424
This commit is contained in:
23
server/render/inlinecss.js
Normal file
23
server/render/inlinecss.js
Normal 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));
|
||||
};
|
||||
Reference in New Issue
Block a user