express-inline-css

1.3.0 • Public • Published

express-inline-css

⚡️ Express middleware to generate inline critical rendering CSS to improve render performance

Build Status Dependencies Status Styled with Prettier Commitizen friendly Greenkeeper badge

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.3.0
    4
    • latest

Version History

Package Sidebar

Install

npm i express-inline-css

Weekly Downloads

4

Version

1.3.0

License

MIT

Unpacked Size

21.4 kB

Total Files

10

Last publish

Collaborators

  • jlopezxs