When a Phoenix web server is not in an umbrella app, Brunch finds the modules in "deps/phoenix/web/static/js/socket"
and "deps/phoenix_html/web/static/js/phoenix_html"
because the phoenix dependency gets installed into that location relative to the brunch config file.
When in an Umbrella app, the dependencies get installed in the umbrella app itself, not the web server app. So they are at "../../deps/phoenix/web/static/js/"
instead.
I tried adding "../.."
to the locations in the brunch config file and the import statements, and I cannot get Brunch to actually find the files.
Phoenix ships with a JavaScript implementation of both websocket and long polling that interacts with Phoenix.Socket and can be used as reference for those interested in implementing custom clients.
A socket implementation that multiplexes messages over channels. Phoenix.Socket is used as a module for establishing and maintaining the socket state via the Phoenix.Socket struct. Once connected to a socket, incoming and outgoing events are routed to channels.
Helpers for working with HTML strings and templates. When used, it imports the given modules: Phoenix.HTML - functions to handle HTML safety; Phoenix.HTML.Tag - functions for generating HTML tags;
Phoenix.HTML.Link - functions for generating links and urls; Phoenix.HTML.Format - functions for formatting text; One of the main responsibilities of this module is to provide convenience functions for escaping and marking HTML code as safe.
You need to configure the brunch config to point to the proper directory:
watched: ["../../deps/phoenix/web/static",
"../../deps/phoenix_html/web/static",
"web/static", "test/static"],
And then import:
import "../../../deps/phoenix_html/web/static/js/phoenix_html"
We should fix Phoenix though to generate such by default inside umbrellas.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With