You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-2Lines changed: 31 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ Your `*_element.js` files have to `export default` custom elements for this to w
52
52
> [!WARNING]
53
53
> Only single word elements are supported currently. See https://github.com/codergeek121/custom_elements-rails/issues/1
54
54
55
-
## Add a custom element
55
+
## Add a custom element with the built-in generator
56
56
57
57
This gem adds a generator to generate new custom elements with:
58
58
@@ -73,11 +73,40 @@ export default class extends HTMLElement {
73
73
console.log("test_element.js")
74
74
}
75
75
}
76
-
77
76
```
78
77
79
78
which in turn will register a `<app-test></app-test>` custom element automatically in your app.
80
79
80
+
```bash
81
+
$ rails generate custom_element test
82
+
```
83
+
84
+
To observe changes in your custom element's attributes, you need to set a static array of attribute names. The generator also supports setting those automatically:
0 commit comments