Skip to content

anthonylewis/amphtml

 
 

Repository files navigation

AMP HTML ⚡

AMP HTML is a way to build web pages for static content that render with reliable, fast performance. It is our attempt at fixing what many perceive as painfully slow page load times – especially when reading content on the mobile web.

AMP HTML is entirely built on existing web technologies. It achieves reliable performance by restricting some parts of HTML, CSS and JavaScript. These restrictions are enforced with a validator that ships with AMP HTML. To make up for those limitations AMP HTML provides a set of custom elements for rich content beyond basic HTML.

For more info how AMP HTML works and some insights into the design, please read our blog post "Web performance: An intervention" (which may be the first AMP HTML file you ever see).

We also have a non-technical description of what we are doing on www.ampproject.org.

For further reading see the AMP HTML format specification and the custom element specification.

Repository Layout

  3p              - Implementation of third party sandbox iframes.
  ads/            - Modules implementing specific ad networks used in 
  build-system/   - build infrastructure
  builtins/       - tags built into the core AMP runtime
      *.md        - documentation for use of the builtin
      *.js        - source code for builtin tag
  css/            - default css
  examples/       - example AMP HTML files and corresponding assets
  extensions/     - plugins which extend the AMP HTML runtime's core set of tags
  spec/           - The AMP HTML Specification files
  src/            - source code for the AMP runtime
  test/           - tests for the AMP runtime and builtins
  testing/        - testing infrastructure

Contributing

Please see the CONTRIBUTING file before developing for the AMP Project.

Installation

  1. npm i
  2. edit /etc/hosts and map ads.localhost and iframe.localhost to 127.0.0.1:
  127.0.0.1               ads.localhost iframe.localhost

Build & Test

Build Status

Command Description
gulp Same as "watch"
gulp minify Builds production binaries.
gulp lint Validates against Google Closure Linter.
gulp build Builds the AMP library.
gulp clean Removes build output.
gulp test Runs tests in Chrome.
gulp test --verbose Runs tests in Chrome with logging enabled.
gulp test --watch Watches for changes in files, runs corresponding test(s) in Chrome.
gulp test --watch --verbose Same as "watch" with logging enabled.
gulp test --safari Runs tests in Safari.
gulp test --firefox Runs tests in Firefox.
http-server -p 8000 -c-1 serves content in current working dir over http://localhost:8000/

To fix issues with Safari test runner launching multiple instances of the test, run:

  defaults write com.apple.Safari ApplePersistenceIgnoreState YES

Manual testing

For testing documents on arbitrary URLs with your current local version of the AMP runtime we created a Chrome extension.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 95.4%
  • HTML 3.4%
  • CSS 1.2%