Background
I have an existing website where I want to import Bootstrap CSS styles. The styles are clashing, so I want to scope the rules.
Example
// node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_modals.scss
.modal {
display: none;
overflow: hidden;
position: fixed;
top: 0;
right: 0;
bottom: 0;
}
// ---
// my-styles.scss
.my-selector {
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap/modals";
}
This results in .my-selector .modal, but I want to have .my-selector.modal.
I want to avoid having to copy-paste the style rules. If I can somehow do it with @extend it would be already great.
Thanks for any suggestions.
I'm not sure that I completely understand the question because
// node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_modals.scssis not parent of the current/standard Bootstrap SASS files.If you're using the latest Bootstrap,
_modal.scsscontains all the SASS modal source. So, if you wanted to @import all the modal rules/classes (.modal, .modal-header, .modal-body, etc...) to another parentmy-selectorclass it would be...SASS Demo: https://codeply.com/p/XjYSfp0s8H