LiveDashboard with --no-html --no-webpack

Hi all, I just generated a Phoenix project with mix phx.new myapp --no-html --no-webpack, and found out that I can still access /dashboard for the LiveDashboard.

I wonder how LiveDashboard works in this case, since I have no frontend stuff (e.g. webpack) at all. Specifically,

  • Is the content of LiveDashboard predefined somewhere (like within Phoenix) and not modifiable?
  • Does LiveDashboard work differently (e.g. bundled vs. unbundled) depending on whether or not I used --no-webpack?
1 Like

I did the same experiment with an API only proof of concept project and I was surprised to see the LiveDashboard too!

LiveDashboard is a completely self contained project, which ships with its own markup/assets. Those don’t become userland code like other stuff the generators generate for you. The only userland code you’ll get is the route placed in the router, some links in the layout for html and some useful plugs. Markup/assets for the dashboard are not meant to be user editable. You can modify the dashboard only through the data passed to the plug in the router, which currently is only metrics via the MyAppWeb.Telemetry module.

5 Likes

That’s because LiveDashboard inlines the styles and javascript in its root template:

<%= raw(render("app.css")) %>
<script><%= raw(render("app.js")) %></script>
2 Likes

Edit: False alarm. Config issue. Problem was between the keyboard and the chair.

I can 100% confirm that livedashboard works even with --no-html switch used in phx proj creation.

I think using --no-dashboard, do not include Phoenix.LiveDashboard