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
+25-13Lines changed: 25 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,24 @@
4
4
5
5
This gem adds a simple way to automatically register custom elements in your `importmap-rails` app. No build step required!
6
6
7
-
- Supports `importmap-rails` v1 and v2.
8
-
- Supports `rails` 7.0, 7.1 & 8.0.
7
+
## Table of Contents
8
+
9
+
<details>
10
+
<summary>Click to expand</summary>
11
+
12
+
-[Rails support](#rails-support)
13
+
-[Installation](#installation)
14
+
-[Generators](#generators)
15
+
-[Documentation](#documentation)
16
+
-[Contributing](#contributing)
17
+
-[License](#license)
18
+
19
+
</details>
20
+
21
+
## Rails support
22
+
23
+
* Supports Rails 7.0, 7.1, 7.2 & 8.0
24
+
* Supports `importmap-rails` 1 and 2
9
25
10
26
## Installation
11
27
@@ -29,7 +45,7 @@ $ rails custom_elements:install
29
45
30
46
This will setup and edit add the following files:
31
47
32
-
```
48
+
```graphql
33
49
app/javascript
34
50
├── application.js
35
51
└── custom_elements
@@ -43,13 +59,7 @@ You can generate a new custom element `<app-demo>` with `rails generate custom_e
43
59
44
60
### How It Works
45
61
46
-
The `custom_elements-rails` gem uses `eagerDefineCustomElementsFrom` to automatically register [custom elements](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements) from the `custom_elements` folder. It reads the importmap from `importmap-rails` and registers elements using `customElements.define(...)`.
The `custom_elements-rails` gem uses `eagerDefineCustomElementsFrom` to automatically register [custom elements](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements) in the `custom_elements` folder. It parses the importmap generated by `importmap-rails` and registers custom elements using the `customElements.define(...)` API.
53
63
54
64
> [!IMPORTANT]
55
65
> Make sure your `*_element.js` files use `export default` to define the custom elements.
0 commit comments