I am using Ruby on Rails with webpacker.
The webpacker setup runs just fine, I already installed jQuery, Bootstrap 4, and Font Awesome.
My webpacker directory currently looks like this:
app/javascript/packs/javascripts/application.js
app/javascript/packs/stylesheets/application.scss
app/javascript/packs/stylesheets/base.scss
In my application.html.erb file:
...
<%= javascript_pack_tag 'javascripts/application', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_pack_tag 'stylesheets/application' %>
...
In my application.js file:
import 'bootstrap/dist/js/bootstrap';
In my application.scss file:
$fa-font-path: '~font-awesome/fonts';
@import '~font-awesome/scss/font-awesome';
@import '~bootstrap/scss/bootstrap';
@import 'base';
I am currently putting my custom CSS in base.scss file and it works just fine.
I want to use a Bootstrap 4 Template more specifically this template PurpleAdmin. It has a custom CSS that has over 20K+ lines of code which you may see here.
Whenever I tried to copy and paste the CSS codes in my base.scss, webpacker raises an error Webpacker can't find stylesheets/application.css
.
But I write my own CSS in the base.scss, it compiles just fine. I also tried putting the template's custom CSS in the sprockets (app/assets/stylesheets/base.scss
) and it works just fine.
I also tried importing the CSS directly in my html.erb file like <link rel='stylesheet' href='http://www.bootstrapdash.com/demo/purple-admin-free/css/style.css'>
and also works just fine.
Why doesn't it work using Webpacker? As I want to drop using sprockets from now.