forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error message for AMP bind syntax (vercel#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
- Loading branch information
Showing
7 changed files
with
99 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# AMP Bind JSX Error | ||
|
||
#### Why This Error Occurred | ||
|
||
Somewhere you used `[prop]='something'` syntax which is not allowed in JSX. | ||
|
||
#### Possible Ways to Fix It | ||
|
||
Instead you can use `data-amp-bind-prop='something'` which is a valid AMP alternative | ||
|
||
### Useful Links | ||
|
||
- [AMP HTML Specification](https://www.ampproject.org/docs/fundamentals/spec) | ||
- [Possible future syntax](https://github.com/ampproject/amphtml/issues/21600) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
"client.js", | ||
"config.js", | ||
"constants.js", | ||
"data.js", | ||
"document.js", | ||
"dynamic.js", | ||
"error.js", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Head from 'next/head' | ||
|
||
const date = new Date().toJSON() | ||
|
||
export default () => ( | ||
<> | ||
<Head> | ||
<script | ||
async | ||
key='amp-timeago' | ||
custom-element='amp-timeago' | ||
src='https://cdn.ampproject.org/v0/amp-timeago-0.1.js' | ||
/> | ||
</Head> | ||
|
||
<amp-timeago | ||
width='160' | ||
height='20' | ||
datetime={date} | ||
layout='responsive' | ||
> | ||
{date} | ||
</amp-timeago> | ||
</> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters