1

I'm having a problem using chosen-js where the styles aren't loading. I'm using webpack, so I'm not sure if there is an additional css file I need to include, but the npm package doesn't seem to have any additional css files.

enter image description here

It seems like it's just rendering as a normal list, and the styles are not imported.

enter image description here

So my question is, do I have to import an additional .css file for chosen.js to work (with webpack)?

1 Answer 1

1

Yes, there is chosen.css which you need to include.

https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.3/chosen.min.css

This file is also present in the npm package.

Also make sure you have the .png files in scope.

Here is the content of the node_modules/chosen-js

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Do you have any recommendations for including it with webpack? Right now I just have import "chosen-js"; in my main javascript file but it's not working
Figured it out, i need to have an additional import "chosen-js/chosen.css" and import "chosen-js/chosen-sprite.png"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.