ampify

Convert plain HTML to Google Accelerated Mobile Pages (AMP).
Installation
npm install ampify --save-dev
Usage
const ampify = require('ampify');
const html = 'YOUR_HTML_CONTENT';
const amp = ampify(html, {cwd: 'amp'});
console.log(amp)
Options
cwd
Assets (images/styles) file path
Type: String
Default: ''
round
Enable images dimensions rounding
Type: String
Default: true
Example
Input
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<img src="image.png">
</html>
image.png
image.png
style.css
body {
background-color: #FFF;
}
Output
<html amp="">
<head>
<style amp-custom="">body{background-color:#FFF}</style>
</head>
<amp-img src="image.png" width="600" height="400"></amp-img>
</html>
Release History
- 0.2.5
- UPDATE: head tag charset order
- UPDATE: remove invalid img tag
- UPDATE: unit tests
- UPDATE: readme documentation
- UPDATE: package.json
- 0.2.4
- 0.2.3
- ADD: meta tag viewport
- ADD: style amp-boilerplate
- 0.2.2
- ADD: meta tag charset
- ADD: AMP library script tag
- BUG: Options parameter not passing
- 0.2.1
- ADD: inline styles
- ADD: amp-img tag
- ADD: amp-video tag
- ADD: unit tests
- 0.1.0
- ADD: AMP HTML tag
- Work in progress
Licence
MIT (c) Ruslan Kazakov