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

Not able to add Bootstrap in production #98

Closed
far11ven opened this issue Jan 14, 2020 · 2 comments
Closed

Not able to add Bootstrap in production #98

far11ven opened this issue Jan 14, 2020 · 2 comments

Comments

@far11ven
Copy link

Issue Summary

Trying to add Bootrap 4.x into the starter template like below, which works fine in development env but gives consequent error:
image

Error:
image

To Reproduce

  1. add following lines to components/common/index.js after adding dependencies using npm i bootstrap jquery popper.js:
import "bootstrap/dist/css/bootstrap.min.css";
import $ from "jquery";
import Popper from "popper.js";
import "bootstrap/dist/js/bootstrap.bundle.min";
  1. try running gatsby build

Any other info e.g. Why do you consider this to be a bug? What did you expect to happen instead?

Technical details:

  • Ghost Version: 3.2.0
  • Gatsby CLI version: 2.8.26
  • Gatsby version: 2.13.45
  • Node Version: 12.10.0
  • OS: windows
@daviddarnes
Copy link
Contributor

This isn’t a bug but a development query, you’re better off asking in our community forum where others also using this starter can help https://forum.ghost.org/ 🙂

@far11ven
Copy link
Author

Found a way to add Bootstrap and related dependency with gatsby is adding them in gatsby-browser.js like following:

Step 1: Run npm i bootstrap jquery popper.js

Step 2: In gatsby-browser.js add following imports

import "bootstrap/dist/css/bootstrap.min.css";
import "jquery/dist/jquery.min.js";
import "popper.js/dist/popper.min";
import "bootstrap/dist/js/bootstrap.min.js";

Note: if gatsby-browser.js is already present and contains ES5 code, then that needs to be converted to ES6 first

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

No branches or pull requests

2 participants