Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fvue opened this issue Aug 11, 2024 · 1 comment
Open

Comments

@fvue
Copy link

fvue commented Aug 11, 2024

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<------------------------------------------------------------------

@tf
Copy link
Member

tf commented Sep 12, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants