Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Create instant loading mobile web pages with AMP

Juan
September 14, 2018

Create instant loading mobile web pages with AMP

Utah JS 2018

Video: https://www.youtube.com/watch?v=DwxcBEMV5Jw
Utah JS: https://www.utahjs.com
Accelerated mobile pages project: https://www.ampproject.org/

Juan

September 14, 2018
Tweet

More Decks by Juan

Other Decks in Programming

Transcript

  1. <!doctype html> <html > <head> <meta charset="utf-8"> <link rel="canonical" href="hello-world.html">

    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> <style amp-boilerplate>/* boilerplate goes here */</style> <script async src="https://cdn.ampproject.org/v0.js"></script> <noscript><style amp-boilerplate>/* boilerplate goes here */</style></noscript> </head> <body>Hello World!</body> </html>
  2. <script></script> <base /> <img /> <video></video> <audio></audio> <iframe></iframe> <frame></frame> <frameset></frameset>

    <object></object> <param /> <applet></applet> <embed /> https://www.ampproject.org/docs/fundamentals/spec
  3. </head> ... <style amp-custom> html { Font-family:sans-serif; } body {

    background-color: white; } amp-img { border: 5px solid red; } </style> ... </head>
  4. for (let i = 0; i < paragraphs.length; i++) {

    paragraphs[i].style.width = box.offsetWidth + 'px'; }
  5. const width = box.offsetWidth; for (let i = 0; i

    < paragraphs.length; i++) { paragraphs[i].style.width = width + 'px'; }