Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serve SentEmailViewer static assets from a plug instead of CDN #517

Open
seivan opened this issue Jan 27, 2020 · 3 comments
Open

Serve SentEmailViewer static assets from a plug instead of CDN #517

seivan opened this issue Jan 27, 2020 · 3 comments

Comments

@seivan
Copy link

seivan commented Jan 27, 2020

Seems like normalize.css is served from some CDN. I'm a bit uncomfortable with having assets that we don't control, it would be nice if there was an opt in feature to allow us to serve that ourselves from a custom plug

Maybe there could be a config like:

config :my_app, MyApp.Mailer,
  adapter: Bamboo.LocalAdapter
  assets: "static"

Then you could just serve the file from /priv/static with a plug:

plug Plug.Static,
  at: "/assets/", from: :api, gzip: true,
  only: ~w(css fonts images js favicon.ico robots.txtn)

I don't mind wiring up a PR for this, if it's acceptable.

@germsvel
Copy link
Collaborator

Hi @seivan, I think this optional configuration could make sense and we can fallback to the CDN. It would be nice for it to work out of the box without configuration. Of course if you don't add normalize, then the preview emails might look different or slightly broken. I'm not actually sure to what extent the preview styles rely on normalize.css.

@DhananjayPurohit
Copy link

I found normalize.css not serving a lot to UI for SentEmailViewer hence implemented css being in use from CDN as internal css.

@seivan
Copy link
Author

seivan commented Oct 28, 2021

@germsvel I think the "out of the box" setting is to just bundle and serve it instead of relying on a third party CDN.

If it's not possible to set up a static plug at installation, then I don't see an issue with asking to implement:

plug Plug.Static,
  at: "/assets/", from: :api, gzip: true,
  only: ~w(css fonts images js favicon.ico robots.txtn)

Since the user still has to set other things up to use it.
If anything Bamboo could just make its own plug that wraps aforementioned configuration.

plug Bamboo.Assets,
  # Default settings 
  # at: "/assets/", from: :api, gzip: true, 
  # only: ~w(css fonts images js favicon.ico robots.txtn)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants