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

Ask A Question

Notifications

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'

and

@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

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

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

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

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.