Ask A Question

Notifications

You’re not receiving notifications from this thread.

Updating CSS classes in production doesnt show changes

Alex Deering asked in General

Ive noticed that anywhere that I adjust the css classes dynamically (select2 boxes and one of my stimulus controllers adds a border when a div is clicked) the classes are added but the display isnt updated on the webpage. Not sure what would cause this, Ive inspected the page and confirmed that the javascript is running, there are no errors and the css classes are added to the div, but just not displaying.

Heres a picture of the select2 boxes. You can see the UL html was added, and the select fields have the hidden property, but are still showing

https://imgur.com/a/i0UCbVD

Reply

Hey Alex,

Not sure it's related to this specific thing, but Jumpstart Pro uses PurgeCSS in production and staging to strip out any unused CSS to make the files as fast as possible. If you didn't have the class referenced in the locations it looks, it can strip out the class on accident when compiling.

You can tweak the whitelist for that in postcss.config.js in the repo and add your own classes to the whitelists so they don't get ignored. It also supports regex so you can use that to whitelist a set of classes too.

Reply

Beautiful, that was it. Thanks so much

Reply
Join the discussion
Create an account Log in

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

Join 81,842+ 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.

    © 2024 GoRails, LLC. All rights reserved.