Choices is a great library and it fits my use case pretty nicely. But I have trouble how to include it in a Rails 6 project.
I have added the js side but have trouble including the css part of the library.
Here is the javascript from application.js
const Choices = require('choices.js')
document.addEventListener("turbolinks:load", function() {
var dropDownSelects = new Choices('.form-select')
})
And the css import from application.scss
@import "choices.js/src/styles/choices.scss";
The above setup works in development but not in production.
The reason was I was using Tailwind with Purgecss which removed all the included classes. Ignore with
/*! purgecss start ignore */
@import "choices.js/public/assets/styles/choices.css";
/*! purgecss end ignore */
Most helpful comment
The reason was I was using Tailwind with Purgecss which removed all the included classes. Ignore with