0.12.2 • Published 6 years ago

ampli v0.12.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

AMPLI

Build Status codecov FOSSA Status

HTML to AMP tranformer

Usage

Install via NPM or yarn.

In your application your can call Ampli like this

import * as log from "log"
import Ampli, { ContextInterface, OptionsInterface } from "ampli"

const options: OptionsInterface | null = {
  //...
}
const additionalDecorators: Function[] | null = [(document: ContextInterface, options: OptionsInterface) => document]

const additionalDecoratorsBefore: Function[] | null = [(document: ContextInterface, options: OptionsInterface) => document]
const html: string = "" //...

const ampli: Ampli = new Ampli(options, additionalDecorators, additionalDecoratorsBefore)
const amp: string = await ampli.transform(html)

log.info(amp)

Options

  • logger?: LoggerInterface, use this object as logger instance, default log
  • useStaticCss?: boolean, remove CSS that is not used, default: false
  • additionalTags?: string[], custom HTML-tags that should be left in code
  • additionalScripts?: AdditionalScriptsInterface[], additional scripts from AMP
  • baseUrl?: string, a static URL to prefix relative file paths with

Constrains

You must provide fully qualified URLs for images, stylesheets.

TODO

  • Make it possible to prefix relative URLs automatically with specific URL
  • Add mechanism to include canonical tag
  • Fix SVG requests

License

This project is under MIT license.

FOSSA Status

0.12.2

6 years ago

0.12.1

6 years ago

0.12.0

6 years ago

0.11.0

6 years ago

0.10.0

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.0

6 years ago