express-inline-css-amp
v3.0.2
Published
Express inline css generator to AMP
Downloads
25
Maintainers
Readme
express-inline-css-amp
:zap: 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 viewhome
loadhome.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]