Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions assets/js/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import "phoenix_html";
import { Socket } from "phoenix";
import topbar from "../vendor/topbar";
import { LiveSocket } from "phoenix_live_view";

let socketPath =
document.querySelector("html").getAttribute("phx-socket") || "/live";
Expand Down Expand Up @@ -228,7 +225,7 @@ let params = () => {
};
};

let liveSocket = new LiveSocket(socketPath, Socket, {
let liveSocket = new LiveView.LiveSocket(socketPath, Phoenix.Socket, {
params: params,
hooks: Hooks,
dom: {
Expand Down
19 changes: 14 additions & 5 deletions lib/ash_admin/components/layouts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@ defmodule AshAdmin.Layouts do
use AshAdmin.Web, :html
use Phoenix.Component

js_path = Path.join(__DIR__, "../../../priv/static/assets/app.js")
css_path = Path.join(__DIR__, "../../../priv/static/assets/app.css")
phoenix_js_paths =
for app <- ~w(phoenix phoenix_html phoenix_live_view)a do
path = Application.app_dir(app, ["priv", "static", "#{app}.js"])
Module.put_attribute(__MODULE__, :external_resource, path)
path
end

@static_path Application.app_dir(:ash_admin, ["priv", "static"])

@external_resource js_path
@external_resource css_path
@external_resource js_path = Path.join(@static_path, "assets/app.js")
@external_resource css_path = Path.join(@static_path, "assets/app.css")

@app_js File.read!(js_path)
@app_js """
#{for path <- phoenix_js_paths, do: path |> File.read!() |> String.replace("//# sourceMappingURL=", "// ")}
#{File.read!(js_path)}
"""
@app_css File.read!(css_path)

def render("app.js", _), do: @app_js
Expand Down
Loading