https://github.com/eder/express-inline-css-amp
Express middleware to generate inline rendering CSS for AMP
https://github.com/eder/express-inline-css-amp
amp css es6 express-middleware expressjs expressjs-framework nodejs sass scss
Last synced: 11 days ago
JSON representation
Express middleware to generate inline rendering CSS for AMP
- Host: GitHub
- URL: https://github.com/eder/express-inline-css-amp
- Owner: eder
- Created: 2017-07-20T18:38:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T13:07:36.000Z (about 3 years ago)
- Last Synced: 2024-04-15T08:08:47.299Z (almost 2 years ago)
- Topics: amp, css, es6, express-middleware, expressjs, expressjs-framework, nodejs, sass, scss
- Language: JavaScript
- Homepage:
- Size: 768 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# express-inline-css-amp
[](https://circleci.com/gh/eder/express-inline-css-amp/tree/master)
> :zap: Express middleware to generate inline rendering CSS for AMP:
```html
Exemple
```
### Generated
```html
Exemple
...
```
## Installation
```sh
npm install --save express-inline-css-amp
```
## Preview
```js
// 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]