S
S
sumrakx2018-12-06 21:08:02
JavaScript
sumrakx, 2018-12-06 21:08:02

How to include Bootstrap in Webpack so that it does not replace other styles?

Good afternoon comrade. I started using Bootstrap in a project, and I ran into a problem that when importing Bootstrap's css, it will replace other global styles such as the Leaflet library. How can it be conveniently connected so that it is connected selectively only in those files where you call it or maybe there are better options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sumrakx, 2018-12-07
@sumrakx

I solved the problem as follows:
In addition to Bootstrap and other libraries that have overlapping styles, you need to:
1) Place Bootstrap at the very top
2) Write a custom css file at the bottom that controls the behavior of Bootstrap.
Read more https://medium.com/commencis/how-to-import-bootstr...
4th point

A
Alexander Kositsyn, 2018-12-07
@alex_keysi

Highlight your custom styles in scope and hash will be added to them. And bootstrap won't have them.
https://github.com/webpack-contrib/css-loader#scope
The solution is a scope to do.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question