eic
express-inline-css-amp
npm i express-inline-css-amp
eic

express-inline-css-amp

Express middleware to generate inline rendering CSS for AMP

by Eder Eduardo

3.0.2 (see all)License:MITTypeScript:Not FoundCategories:Express AMP
npm i express-inline-css-amp
Readme

express-inline-css-amp

CircleCI

⚡ Express middleware to generate inline rendering CSS for AMP:

<!doctype html>
<html ⚡>
  <head>
    <title>Exemple</title>
  </head>
</html>

Generated

<!doctype html>
<html ⚡>
  <head>
    <title>Exemple</title>
    <style amp-custom>
      ...
    </style>
  </head>
</html>

Installation

  npm install --save express-inline-css-amp

Preview

// The render method
import path from 'path';
import express from 'express';
import inlineCSSAMP from 'express-inline-css-amp';

const app = express();
// Yes its works with css, scss and sass \o/
app.use(inlineCSSAMP({
  CSSPathBase: path.join(__dirname,'../public/assets/css/'),
  CSSFilePath: path.join(__dirname,'../public/assets/css/style.scss'),
  version: new Date().getTime(),
}));

app.get('/', (req, res) => {
  res.render('index', {});
});

  • Yes its works with css, scss and sass \o/ and load css by view eg. the view home load home.css if one exists.

  • CSSPathBase: This path is set as /tmp/ by default used to load css compiled;

  • CSSFilePath: Path of the final css file where rules are taken out.

  • CCSMinify: Default is true, this brings up the possibility of mifying the css file.

  • version: value - Now, we can cache from css generated automatically just in production

License

MIT © [Eder Eduardo]

Downloads/wk

27

GitHub Stars

2

LAST COMMIT

3yrs ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

11
VersionTagPublished
3.0.2
latest
3yrs ago
No tutorials found
Add a tutorial