Socket
Socket
Sign inDemoInstall

@bradymholt/ampify

Package Overview
Dependencies
81
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @bradymholt/ampify

Convert plain HTML to Google Accelerated Mobile Pages (AMP)


Version published
Maintainers
1
Created

Readme

Source

ampify

Convert plain HTML to Google AMP (Accelerated Mobile Pages)

Installation

npm install @bradymholt/ampify

Usage

const ampify = require('ampify');
const html = '<YOUR_HTML_CONTENT>';
const amp = await 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="styles.css">
  </head>
  <img src="image.png">
</html>

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>

Licence

MIT (c) Ruslan Kazakov and contributors

Keywords

FAQs

Last updated on 11 Apr 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc