apalfrey / select2-bootstrap-5-theme

A Select2 v4 theme for Bootstrap 5
https://apalfrey.github.io/select2-bootstrap-5-theme/
MIT License
212 stars 48 forks source link

Hard-coded paths to Bootstrap dependencies cause failures with popular project structures #44

Closed NetherGranite closed 2 years ago

NetherGranite commented 3 years ago

This project's Sass contains hard-coded paths to Bootstrap's Sass, assuming it can be found in a node_modules folder in the root of the including module:

https://github.com/apalfrey/select2-bootstrap-5-theme/blob/d63866a6687b3cd3175f47b1d512eefbd8e7f46d/src/select2-bootstrap-5-theme.scss#L5-L7

This fails under any other structure—e.g. as NPM 7 Workspaces, which has node_modules in a different location.

Is it possible to switch to the use of automatically-resolving imports/include directories so that the following can be used instead?

 @import "bootstrap/scss/functions"; 
 @import "bootstrap/scss/variables"; 
 @import "bootstrap/scss/mixins"; 
apalfrey commented 2 years ago

I haven't used the npm workspaces yet, however it sounds like this could cause some compatibility issues with any project that's currently using this, meaning they'd have to change their compiler settings also...

However, someone did have an issue similar to this previously and submitted a pull request for it, which is part of the project: #4 Instead of importing the core SCSS file, you instead import select2-bootstrap-5-theme/src/include-all, with your correct location to Bootstrap before it.