Skip to content

Commit 34c89a5

Browse files
Merge pull request #7 from WTW-IM/polyfills-documentation
Documenting Polyfills & Adding Github Updating to semantic-release
2 parents 6e72a56 + c5296be commit 34c89a5

File tree

4 files changed

+33
-169
lines changed

4 files changed

+33
-169
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,44 @@ customElements.define('incrementer', ReactTestComponent);
5959

6060
The key pieces of code are `... extends ReactHTMLElement` and `this.mountPoint`.
6161

62+
> One thing to remember is that you will need to load [the webcomponentsjs polyfills](https://www.webcomponents.org/polyfills) for `ReactHTMLElement` to work in all browsers. The polyfills should be in the `<head>`, and should look something like this:
63+
>
64+
> ```html
65+
> <script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/webcomponents-bundle.js"></script>
66+
> <script>
67+
> if (!window.customElements) {
68+
> document.write('<!--');
69+
> }
70+
> </script>
71+
> <script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/custom-elements-es5-adapter.js"></script>
72+
> <!--- We use the closing bracket of this comment to close off the above opening comment, if it gets written -->
73+
> ```
74+
>
75+
> There are many ways to implement these polyfills, and you can explore them in the [webpcomponentsjs README](https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs#how-to-use).
76+
6277
This will allow us to utilize our Web Component as an element in any HTML:
6378
6479
```html
6580
<html>
6681
<head>
6782
<title>Incrementer Example</title>
83+
<!-- Load the polyfills -->
84+
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/webcomponents-bundle.js"></script>
85+
<script>
86+
if (!window.customElements) {
87+
document.write('<!--');
88+
}
89+
</script>
90+
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/custom-elements-es5-adapter.js"></script>
91+
<!--- We use the closing bracket of this comment to close off the above opening comment, if it gets written -->
92+
<!-- load your web component -->
6893
<script src="./path/to/incrementer.js"></script>
6994
</head>
7095
<body>
7196
<h1>
7297
Behold: An Incrementer
7398
</h1>
99+
<!-- put your web component in your html -->
74100
<incrementer></incrementer>
75101
</body>
76102
</html>

package-lock.json

Lines changed: 0 additions & 166 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-html-element",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"description": "An HTMLElement extension that provides a simple setup for Web Components using React.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -64,7 +64,6 @@
6464
"@types/react-dom": "^16.9.5",
6565
"@typescript-eslint/eslint-plugin": "^2.24.0",
6666
"@typescript-eslint/parser": "^2.24.0",
67-
"babel-loader": "^8.1.0",
6867
"conventional-changelog-eslint": "^3.0.4",
6968
"eslint": "^6.5.1",
7069
"eslint-config-airbnb-typescript": "^7.2.0",

release.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ module.exports = {
44
'@semantic-release/commit-analyzer',
55
'@semantic-release/release-notes-generator',
66
'@semantic-release/changelog',
7-
'@semantic-release/github',
7+
[
8+
'@semantic-release/github',
9+
{
10+
message: 'Docs: ${nextRelease.version} [skip ci]\n\n${nextRelease.note}'
11+
}
12+
],
813
'@semantic-release/npm'
914
],
1015
preset: 'eslint'

0 commit comments

Comments
 (0)