Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rails Webpack Setup MDBootstrap

Starting from Lewagon Template

rails new \
  --database postgresql \
  --webpack \
  -m https://raw.githubusercontent.com/lewagon/rails-templates/master/devise.rb \
  CHANGE_THIS_TO_YOUR_RAILS_APP_NAME

Then

yarn add @fortawesome/fontawesome-free bootstrap datatables.net es6-promise hammerjs jquery node-waves popper.js underscore wow.js mdbootstrap

application.scss

// Fontawesome 5
$fa-font-path: '@fortawesome/fontawesome-free/webfonts' !default;
@import '@fortawesome/fontawesome-free/scss/fontawesome.scss';
@import '@fortawesome/fontawesome-free/scss/solid.scss';
@import '@fortawesome/fontawesome-free/scss/brands.scss';
@import '@fortawesome/fontawesome-free/scss/regular.scss';

// Bootstrap 4
@import 'bootstrap/scss/bootstrap';

/**
 * Override MDB variables.
 * Tell MDB where to find its fonts and images
 */
$image-path: 'mdbootstrap/img' !default;
$roboto-font-path: 'mdbootstrap/font/roboto/' !default;

// MDB main scss file
@import 'mdbootstrap/scss/mdb.scss';

// MDB Addons
// @import 'mdbootstrap/scss/addons/datatables';

application.js

import 'jquery';
import 'popper.js';
import 'bootstrap';
import '@fortawesome/fontawesome-free/js/all';
import 'mdbootstrap/js/mdb';
import 'mdbootstrap/js/addons/datatables';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment