Ask A Question


You’re not receiving notifications from this thread.

How do you figure out what and how to load the css/scss assets with Webpacker

Greg S asked in Rails

For Bootstrap you added to application.scss(I may have named my folder differently:

import "bootstrap"
import 'bootstrap/dist/js/bootstrap'


@import '../css/bootstrap_custom';
@import "~bootstrap/scss/bootstrap";  // the tilde seems to be optional?

I reverse engineering this for an OpenLayers' module but the directory structures don't seem to follow a pattern and I plan to add other OpenLayers modules and wondered if how one knows what to add where? Although adding to application.js seem to work but javascript/css/application.scss is more logical.

gems were easier, but none current is available for OpenLayers. Seems to me application.js file should be in javascripts not buried in packs. Maybe I need a primer on Webpack.

Thank you for the great web casts.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 76,990+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.