All threads / Updating CSS classes in production doesnt show changes

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

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.

Beautiful, that was it. Thanks so much

Join the discussion

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

Join 35,699+ 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.