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

Remove external CDN and package bootstrap directly #13

Closed
bensheldon opened this issue Nov 26, 2024 · 3 comments · Fixed by #16
Closed

Remove external CDN and package bootstrap directly #13

bensheldon opened this issue Nov 26, 2024 · 3 comments · Fixed by #16
Labels
help wanted Extra attention is needed

Comments

@bensheldon
Copy link
Contributor

This is a great looking Rails Engine! 🙇🏻

Unfortunately, I can't use it because it has a dependency on Bootstrap delivered by a 3rd party CDN so it won't pass a security review:

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">

It would be awesome for you to vender and serve Bootstrap directly in the Engine. I documented how I did that with GoodJob:

https://island94.org/2023/03/how-goodjob-s-mountable-rails-engine-delivers-javascript-importmaps-and-frontend-assets

And here's a more recent time I set it up in Spectator Sport:

bensheldon/spectator_sport#20

I'd be happy to help too.

@mbajur
Copy link
Owner

mbajur commented Nov 26, 2024

Thank you @bensheldon !

I gave that a lot of thoughts before and as much as i don't like serving bootstrap or anything else from CDN, i just went for the simplicity. But that's temporary, unless i figure out how to do that better. My concerns are:

  1. I would really wish Bootstrap was part of the gem itself or somehow plugging in to whatever assets engine parent app is using and be served locally but that slightly above my knowledge in this regard so i would need to make a proper research on how to approach that. Article you linked looks interesting and i will definitely look into it once i have more time :)
  2. I could just use a boostrap gem but i don't think that's a dependency i want to add to the stack of all the inner_performance users
  3. Bootstrap seems a bit like an overkill for such a simple app but on the other hand, it's well know by everyone, anyone can contribute easily and it just looks nice, simple and familiar which all takes off the weight of maintaining and reviewing custom css off my shoulders

I don't have much time to dig into that ATM but i'm super open for resolving that and will welcome any PRs with open arms.

Btw, never heard of spectator_sport before but it looks absolutely awesome and i can't wait to use it. Also great to have an author of my fav and go-to background job processing on board 💪 Thank you for all the great work you do!

@mbajur mbajur added the help wanted Extra attention is needed label Nov 26, 2024
@bensheldon
Copy link
Contributor Author

We are in agreement 1000%.

The approach I've used in GoodJob and Spectator Sport is to vendor and serve the assets out of a custom controller in the gem. It's entirely self contained and kept separate from the patent app's asset pipeline. I even set up a custom importmap declaration for JavaScript; again entirely self contained and without any gem dependencies.

Let me try to make a quick PR this week of at least the CSS part of it.

@mbajur
Copy link
Owner

mbajur commented Nov 26, 2024

Would be great, thank you! CSS part should be enough as inner_performance does not and probably will not use any bootstrap JS anytime soon or maybe even never :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants