elixir-error-tracker / error-tracker

🐛 An Elixir-based built-in error reporting and tracking solution
https://hex.pm/packages/error_tracker
Apache License 2.0
383 stars 17 forks source link

How to merge css / js? #45

Closed gernotkogler closed 2 months ago

gernotkogler commented 2 months ago

Maybe just be a newbie question, but I get zero styling on error_tracker_dashboard. I followed the setup guide but I don't know how the assets should be merged.

crbelaus commented 2 months ago

The assets are read and included in the ErrorTracker package compilation. You shouldn't have to do anything special to get both the CSS and JS working.

I've just started a fresh new Phoenix project and added ErrorTracker as a dependency to test this. In my case the assets are working as expected.

Are you using the latest ErrorTracker version (at the time of this comment it is v0.2.1)? Do you get an errors during compilation?

gernotkogler commented 2 months ago

I have a fairly new phoenix app and all deps are up to date. I deleted _build and deps and rebuilt everything from scratch, without errors. I even deleted my app.css, but I don't get any css styling for the error tracker pages.

Bildschirmfoto 2024-08-15 um 11 54 58
crbelaus commented 2 months ago

What version of ErrorTracker are you using @gernotkogler? You can see it by running mix deps | grep error_tracker

gernotkogler commented 2 months ago
numso commented 2 months ago

I initially experienced this same issue. In my case it was caused by my app's CSP blocking the styles/scripts. Adding 'unsafe-inline' to both style-src and script-src fixed it for me. Any chance you've got a CSP in your app that might be blocking things?

gernotkogler commented 2 months ago

Thank you so much, @numso! That fixed it! I'm still fairly new to CSP

gernotkogler commented 2 months ago

For the record: I had to add style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' to my CSP. Without 'self', my own css / js didn't work anymore

crbelaus commented 2 months ago

I was wondering where the issue could be, since both CSS and JS are inlined in the ErrorTracker dashboard. This makes sense.

Should be probably mentioned in the documentation as others may experience the same problem.