Commit graph

21 commits

Author SHA1 Message Date
Sebastian Benz
ae9b13e0be
Migrate to AMP Optimizer 2.0 (#10535)
* Migrate to AMP Optimizer 2.0

Most notable changes:

* Automatically import all missing AMP component scripts.
* Automatically add any missing mandatary AMP tags.
* 40% faster

I've updated the docs to mention component auto import and added a corresponding
test case.

* change validator tests which now pass validation

* Improve wording

Co-Authored-By: JJ Kasper <jj@jjsweb.site>

* Update adding-amp-components.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-14 16:01:43 -05:00
JJ Kasper
fd95d6c8bc
Fix AMP HMR for child components (#9736) 2019-12-16 11:45:48 -06:00
JJ Kasper
409f20a9ca
Fix AMP HTML content emit (#9468)
* Add failing test

* Escape dollar signs in AMP HTML

* Update to not use replace for updating AMP_RENDER_TARGET
2019-11-25 14:05:52 -06:00
Joe Haddad
18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00
JJ Kasper
4bcf6aabe7 Allow manually setting amphtml and canonical links (#8129) 2019-07-29 08:18:23 +01:00
JJ Kasper
fa45fa0a60
Add export const config support and make withAmp a no-op (#7525)
* Add export const config support and make withAmp a no-op

* Use babel plugin for PageConfig

* Fix serverless-loader exports

* Add backwards compatibility for withAmp
2019-06-09 17:16:14 -07:00
Joe Haddad
b3170d2648
Format missed files (#7464)
* Format missed files

* Remove unnecessary rule

* Fix type error
2019-05-29 18:19:32 -07:00
JJ Kasper
dc47c607d7
Make sure to 404 for AMP client bundles in dev mode (#7183)
* Make sure to 404 for AMP bundle in dev mode

* Add test for non-AMP to AMP navigating in dev mode
2019-04-28 13:08:38 -05:00
JJ Kasper
fdfbab5d25 Updated handling of AMP page reloading (#7052) 2019-04-16 18:04:41 -05:00
JJ Kasper
11016221cd
Make sure AmpContext is available in _document (#7021)
* Make sure AmpContext is available during _document
render and update filtering of script tags in AMP mode

* Update amphtml test to make sure
AmpContext is set for _document render

* Fix stray comma in render.tsx
2019-04-12 19:04:52 -05:00
JJ Kasper
e5111745b5
Replace .amp.js with withAmp(Comp) (#7009)
* Add WithAmp to enable AMP support for
pages instead of .amp.js

* Update handling for exporting AMP

* Fix ampPath in export for / path and
revert isAmp logic to handle right

* Update amphtml test suite

* Add handling for noDirtyAmp during
export and update amp-export test suite

* Update serverless and export-default-map
test suites

* Update require-page tests
2019-04-11 13:59:26 -05:00
JJ Kasper
aac50e4501
Add error message for AMP bind syntax (#6865)
* Add error message for AMP bind syntax

* Fix custom AMP scripts getting dropped

* Add data.js to package.json to include it
in releases
2019-04-02 17:32:07 -05:00
JJ Kasper
26a4eb827c Add dropping of custom scripts in AMP mode (#6830)
Drops user `<script>` tags and shows a warning in AMP mode. Right now they are only dropped in production mode and left in dev mode so the validator shows its warning since it looks like conflicting props log messages are being cleared causing them to not show. 

Closes: #6688
2019-03-29 17:20:12 +01:00
JJ Kasper
bce75ae9c3
Add checking for corresponding pages for link tags (#6719) 2019-03-19 14:01:42 -05:00
JJ Kasper
12cbb934b3 Add support for creating AMP pages (#6706)
* Add support for .amp.js pages and
resolving /page?amp=1 to page.amp.js

* Update amp tests

* Update example and clean up amp page resolving

* Add nested amp test

* page => normalizedPage

* Add type to page options

* Add handling of amp with all pageExtensions
and normalize page

* Make sure findPageFile only falls back to
amp if enabled
2019-03-18 23:24:21 -04:00
JJ Kasper
2d6a73cb66 Remove conflicting <head> tags in amp mode (#6693) 2019-03-18 12:29:31 +01:00
Joe Haddad
330bedacc7 Add Babel plugin that fixes className for Amp elements (#6486)
This is a simple Babel plugin that overwrites certain attributes for `amp-` elements.
2019-02-28 23:04:29 +01:00
Joe Haddad
f15cfeba0a
AMP automatic page refreshing in dev (#6392)
* AMP page reload

* Fix comment

* Skip dev files in production

* Polyfill event source

* Add HMR test for AMP

* Use webdriver

* Use a dynamic server for HMR test

* ffs
2019-02-25 17:00:14 -05:00
Connor Davis
fcf1167cd4 Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12
2019-02-19 22:45:07 +01:00
Joe Haddad
ee18967dfc Add tests for AMP style tags (#6355)
Relevant commit: f913aabe16

~~I needed to upgrade Standard to work with JSX fragment syntax.~~ This caused too much noise so I just stopped using Fragments.
2019-02-19 16:37:19 +01:00
Tim Neutkens
4051ffcb01 [experimental] Rendering to AMP (#6218)
* Add initial AMP implementation

* Implement experimental feature flag

* Implement feedback from sbenz

* Add next/amp and `useAmp` hook

* Use /:path*/amp instead

* Add canonical

* Add amphtml tag

* Add ampEnabled for rel=“amphtml”

* Remove extra type
2019-02-14 10:22:57 -05:00