Skip to content

Instantly share code, notes, and snippets.

@buncis
Last active March 2, 2021 15:16
Show Gist options
  • Save buncis/1d6583b36ab81429c5f5ca4d4c66407b to your computer and use it in GitHub Desktop.
Save buncis/1d6583b36ab81429c5f5ca4d4c66407b to your computer and use it in GitHub Desktop.
add bootstrap 4.6 to rails 6
yarn add bootstrap jquery popper.js
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
import Rails from "@rails/ujs";
import Turbolinks from "turbolinks";
import * as ActiveStorage from "@rails/activestorage";
import "channels";
import "bootstrap";
Rails.start();
Turbolinks.start();
ActiveStorage.start();
@import "bootstrap/scss/bootstrap";
// rename application.css and replace the content with this
const { environment } = require("@rails/webpacker");
const webpack = require("webpack");
environment.plugins.append(
"Provide",
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
Popper: ["popper.js", "default"],
})
);
module.exports = environment;
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: app/assets/stylesheets/application.css
modified: app/javascript/packs/application.js
modified: config/webpack/environment.js
modified: package.json
modified: yarn.lock
Untracked files:
(use "git add <file>..." to include in what will be committed)
app/assets/stylesheets/application.scss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment