Gatsby with bootstrap and jquery
See original GitHub issueI have a mixed project – not all of it is full-react, unfortunately, there are some pieces of code that I have to render as plain html and use some jquery scripts to operate it. No way to re-write to react. Anyways, I am trying to integrate jquery with bootstrap, and keep having issues. First I tried with ReactHelmet, but bootstrap was always complaining that jquery is missing. Bootstrap docs say to add it’s scripts to the end of <body>,
So I have overriden html.js
and added bootstrap there.
Now the problem is, when I run this thing and check the code – <script> tags no longer have crossorigin parameter in them, and I get an error that:
Subresource Integrity: The resource 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js' has an integrity attribute, but the resource requires the request to be CORS enabled to check the integrity, and it is not. The resource has been blocked because the integrity cannot be enforced.
How can I make gatsby keep crossorigin
?
Issue Analytics
- State:
- Created 6 years ago
- Comments:17 (6 by maintainers)
Top Results From Across the Web
How to add bootstrap js in a Gatsby Website - Stack Overflow
js ). First, I installed the dependencies using npm : npm install bootstrap jquery @popperjs/core. And, here is how I ...
Read more >Other CSS Frameworks | Gatsby
Bootstrap is a widely used CSS and JS framework that was created at Twitter in 2010. It gained popularity for its support of...
Read more >Adding Bootstrap 5 to your Gatsby project - Ibrahim Haouari
In this article we will talk about how to add bootstrap 5-beta1 in our gatsby project. Install bootstrap and popper.js modules.
Read more >Overwriting Bootstrap Themes in GatsbyJS | by Kyle Calica-St
1. Install Bootstrap using npm. Bootstrap 5 does not require JQuery anymore but does require popperjs. · 2. Add the `gatsby-plugin-sass` · 3....
Read more >Bootstrap VS Gatsby - JavaScript Technologies Market Share ...
2 Gatsby hasn't got a lead over Bootstrap in any country. Related Technology Comparisons. Bootstrap VS jQuery · Bootstrap VS Google Tag ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If this helps someone, this is how we currently use Bootstrap v3 on our site. Note that we didn’t want to re-implement into something like React-Bootstrap which uses a different syntax for components.
The project is in TypeScript and the example demonstrates Modal and Popover components, the later of which requires custom JS initialization via
$('[data-toggle="popover"]').popover()
.What I didn’t manage to work is installing jQuery & Bootstrap as dependencies and
import
ing them – some internal things in Bootstrap JS couldn’t find$.fn
and things like that even though I addedwebpack.ProvidePlugin
(some examples on how to do it here or here) into custom Gatsby config.Hey folks, there seems to be a bit of confusion here — cross origin has nothing to do particularly with Gatsby. It’s needed whenever you reference resources from other domains. See the MDN docs https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes
Why adding
crossorigin
isn’t working is that React requires all HTML properties to use camel case socrossOrigin
. So this has nothing to do with webpack either.Thanks for the PR @EarthSchlange! https://github.com/gatsbyjs/gatsby/pull/4578 We always appreciate when people pitch in to help make Gatsby better for everyone.