5 ms·
Ah the worst thing about Bootstrap is jQuery because it's a pain to integrate it into Single Page Applications properly. That's why I enjoy Bulma (bulma.io) so
by cygned 10y ago
Ah the worst thing about Bootstrap is jQuery because it's a pain to integrate it into Single Page Applications properly. That's why I enjoy Bulma (bulma.io) so much - just CSS but still 90% of the stuff you get in Bootstrap.
- Ralfp 10y agoI don't really understand whats so hard about using Bootstrap with it's JS in SPA. I've adapted BS components for Ember.js, I've did same with Mithril.js and then React.js, and I've never had problems. My only pain points were lack of proper destructors for use in tests.
- cygned 10y agoI also use it with React, but it took me some time to set it up properly. The challenge is, that import jquery from 'jquery' window.$ = window.jQuery = jquery; import 'bootstrap'; doesn't really work because webpack (what we use) moves all import statements to the top. That can be solved by import bootstrap with require('bootstrap'); though. However, the more challenging and annoying part are plugins because jQuery uses it's own plugin registry ($.fn). Most of the plugins are so nice to require it if require is available. But, the things you get from require are cached, thus, if you do const $ = require('jquery'); $.fn.yada = ... your registered function will not be available to other jQuery imports. Long story short, what's so annoying about this technology is the fact that it does not fit the modularized setups very well but you are forced to find a way for it to work when you want to use bootstrap with the JavaScript additions.
- tracker1 10y agoYou can inject window.$ and window.jQuery via webpack directly, making the inclusion implicit... there's a minor amount of additional script added, and it makes it unavailable to attach to the actual window, but I find the DOM interfaces sufficient in the console anyway.
- cygned 10y agoI added it via expose-loader and with the ProvidePlugin but neither of it worked. Eventually some technique (loader, plugin and/or require()) made it work and I gave up and didn't touch it since then.
- the_duke 10y agoTrue. That's why there are often component libraries that duplicate the JS driven logic of Bootstrap compoents, like reactstrap and react-bootstrap. Those often remain incomplete though.
- woah 10y agoI've found reactstrap to be pretty complete.