Coder Social home page Coder Social logo

Comments (4)

jonnyeom avatar jonnyeom commented on July 23, 2024 1

The starter integrated the css portion automatically but it does not load js automatically.

What I did was

Require the jquery and popper.js libraries.

npm install jquery popper.js --save-dev

And then import them where I needed it. e.g.

import 'jquery/dist/jquery.min'
import 'popper.js/dist/popper.min'
import 'bootstrap/js/dist/util'
import 'bootstrap/js/dist/carousel'

I think the documentation could be updated to explain this.

from gatsby-starter-bootstrap.

jaxx2104 avatar jaxx2104 commented on July 23, 2024

@jonnyeom
Thank you for the polite explanation on my behalf.

@vallard
I think I'll put it in the README.

from gatsby-starter-bootstrap.

jonnyeom avatar jonnyeom commented on July 23, 2024

@jaxx2104 Before you do, I found that the method I used above works during gatsby develop but not during gatsby build.
instead of that method, I am now using a gatsby-browser.js.

I simply created a gatsby-browser.js file at the root of the project, and added all of my js dependencies.

// Import all js dependencies.
import 'jquery/dist/jquery.min.js'
import 'popper.js/dist/popper.min'
import 'bootstrap/js/dist/util'
import 'bootstrap/js/dist/carousel'
import 'bootstrap/js/dist/dropdown'

All this does is import these dependencies on all gatsby pages.

Because these js utilities are used on most of my pages, I am okay with this.
But I with I could get individual imports of JS dependencies per component file working correctly.

from gatsby-starter-bootstrap.

jaxx2104 avatar jaxx2104 commented on July 23, 2024

👍
https://github.com/jaxx2104/gatsby-starter-bootstrap/releases/tag/2.1.0

from gatsby-starter-bootstrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.