Ask A Question

Notifications

You’re not receiving notifications from this thread.

Esbuild

Mountaindog asked in Rails

I'm trying to get away from Webpacker... Installed the gem JSBundling on a Rails 6.0.1.x app, followed the setup procedures to use EsBuild, and it worked. Got BootStrap 5 working with the guidance from your screencast. Thanks! Installed bootstrap icons with Yarn. Added: @import bootstrap-icons/font/bootstrap-icons to my application.bootstrap.scss file. Fired up the dev server - bin/dev - works perfectly. Icons!!! When I test in the production setting (rails s -e production), it's broken. I've tried RAILS_ENV=production rake assets:precompile`` without any success. It does work if I change this config setting in the Config -> Environment -> Production config.assets.compile = false ``` to true. Thoughts on how to remedy this?

Reply

I noticed the sassc-rails gem will enable itself in production if there is no css_compressor set. You might set css_compressor = nil and see if that fixes it.

Reply

Thanks, Chris. Tried setting config.assets.css_compressor = :sass to nil and no luck. Even tried enabling the:sass option, recompiled the app. No luck. I noticed this is happening with another Yarn package I'm using that has images (SVG) in the node_modules dir. I'm wondering if something should be added to the manifest.is file?

Reply

What it looks like is any sort of "image (jpg, SVG, maybe fonts, etc...)" reference in a CSS file, for example, background-image URL("someimage.jpg") is not being picked up / path issue.?. Hence why Bootstrap Icons are not working.

Reply
Join the discussion
Create an account Log in

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

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

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