activeadmin-searchable_select icon indicating copy to clipboard operation
activeadmin-searchable_select copied to clipboard

Error with cssbundling: Can't find stylesheet to import @import "select2"

Open fvue opened this issue 1 year ago • 1 comments

searchable_select.scss-1.8.0 does not work with cssbundling gem because @codevise/activeadmin-searchable_select/src/searchable_select.scss does an '@import "select2"' which should be spelled out with cssbundling (see: https://github.com/rails/cssbundling-rails): @import "select2/dist/css/select2";

Workaround is not to include the vendor '@codevise/activeadmin-searchable_select/src/searchable_select.scss' in your active_admin.scss, but instead copy the contents of @codevise/activeadmin-searchable_select/src/searchable_select.scss in your active_admin.scss:

app/assets/stylesheets/active_admin.scss

//---8<------------------------------------------------------------------- // NOTE: searchable_select.scss-1.8.0 does not work because it does an '@import "select2"' // which should be spelled out: @import "select2/dist/css/select2"; // @import '@codevise/activeadmin-searchable_select/src/searchable_select.scss';

@import "select2/dist/css/select2";

.searchable_select.input .select2-container { min-width: 30%; } //---8<------------------------------------------------------------------

fvue avatar Aug 11 '24 09:08 fvue

I'd be open to a PR that rewrites the import statement when we prepare the stylesheet for the published npm package. The file in app/assets/stylesheets would still need the unaltered import to keep the asset pipeline case working since there we import from the select2-rails gem which has a different internal structure.

tf avatar Sep 12 '24 07:09 tf