Nifty Pony Merchandise

    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

    Install

    npm i express-inline-css

    DownloadsWeekly Downloads

    3

    Version

    1.3.0

    License

    MIT

    Unpacked Size

    21.4 kB

    Total Files

    10

    Last publish

    Collaborators

    • jlopezxs