Skip to content

Commit 3168995

Browse files
authored
Update README.md
1 parent 3c07090 commit 3168995

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Custom Elements with Rails
22

3-
This gem provides a small js-helper, installation and generators to use custom elements in conjunction with `importmap-rails`.
3+
This gem provides a small js-helper, installation and generators to use custom elements in conjunction with `importmap-rails` gem.
44

55
## Usage
66

@@ -23,7 +23,7 @@ Run the initial setup:
2323
$ rails custom_elements:install
2424
```
2525

26-
This will setup and add the following files:
26+
This will setup and edit add the following files:
2727

2828
```
2929
app/javascript
@@ -37,16 +37,17 @@ You can now add the `<app-hello>` custom element in your HTML. No build step nee
3737

3838
## How it works
3939

40-
`eagerDefineCustomElementsFrom("custom_elements", { prefix: "app" })` will parse the JSON-importmap rendered by the `importmap-rails` gem and register custom elements with `customElements.define(...)` to the browser's custom element registry.
40+
`eagerDefineCustomElementsFrom` will parse the JSON-importmap rendered by the `importmap-rails` gem.
41+
It registers custom elements with `customElements.define(...)` to the browser's custom element registry based on the filename automatically.
4142

4243
```
4344
custom_elements/hello_element.js // will register <app-hello>
4445
```
4546

46-
Your `_element.js` files have to `export default` custom elements for this to work.
47+
Your `*_element.js` files have to `export default` custom elements for this to work properly.
4748

4849
> [!WARNING]
49-
> Only single word elements are support currently.
50+
> Only single word elements are supported currently. See https://github.com/codergeek121/custom_elements-rails/issues/1
5051
5152

5253
## Add a custom element

0 commit comments

Comments
 (0)