Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ampify

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampify

Convert plain HTML to Google Accelerated Mobile Pages (AMP)

  • 0.2.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-12.58%
Maintainers
1
Weekly downloads
 
Created
Source

ampify

NPM Version Downloads Stats

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) // Content of AMP HTML

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.6
    • UPDATE: unit tests
  • 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
    • UPDATE: package.json
  • 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

Keywords

FAQs

Package last updated on 27 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc