express-inline-css
v1.3.0
Published
Express inline CSS generator
Downloads
33
Readme
express-inline-css
:zap: Express middleware to generate inline critical rendering CSS to improve render performance
Installation
npm install --save express-inline-css
Preview
// Overriding the render method
import express from 'express';
import inlineCSS from 'express-inline-css';
const app = express();
app.use(inlineCSS({
override: true,
cssFilePath: '../client/public/css/style.css'
}));
app.get('/', (req, res) => {
res.render('index', {});
});
// Using renderInlineCSS method
import express from 'express';
import inlineCSS from 'express-inline-css';
const app = express();
app.use(inlineCSS({
override: false,
cssFilePath: '../client/public/css/style.css'
}));
app.get('/', (req, res) => {
res.renderInlineCSS('index', {});
});
Usage
inlineCSS({ cssFilePath, [override] });
where:
cssFilePath
: Path of the final css file where rules are taken out.override
(optional): It brings you the possibility to override the method render or use renderInlineCSS method.
License
MIT © Jordi López