File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -113,9 +113,21 @@ defmodule Phoenix.LiveView.ColocatedJS do
113113 `esbuild`. Because colocated JS is extracted to a folder outside the regular `assets` folder,
114114 special care is necessary when you need to import other files inside the colocated JS:
115115
116- ```javascript
117- import { someFunction } from "some-dependency";
118- import somethingElse from "@/vendor/vendored-file";
116+ ```heex
117+ def sha256(assigns) do
118+ ~H"""
119+ <div id="sha-256" phx-hook=".Sha256">Hello World</div>
120+ <script :type={Phoenix.LiveView.ColocatedHook} name=".Sha256">
121+ import { sha256 } from "my-example-sha256-library"
122+ import { reverse } from "@/vendor/vendored-file"
123+ export default {
124+ mounted() {
125+ this.el.innerHTML = sha256(reverse(this.el.innerHTML))
126+ }
127+ }
128+ </script>
129+ """
130+ end
119131 ```
120132
121133 While dependencies from `node_modules ` should work out of the box , you cannot simply refer to your
You can’t perform that action at this time.
0 commit comments