Bootstrap
Bootstrap - Optimize(최적화)
고코모옹
2021. 5. 29. 21:10
https://getbootstrap.com/docs/5.0/customize/optimize/
Optimize
Keep your projects lean, responsive, and maintainable so you can deliver the best experience and focus on more important jobs.
getbootstrap.com
- 예) Dropdown 컴포넌트 최적화
- bundle로 import 하던 것을 Dropdown만 import 하도록 변경
- Dropdown 초기화
- bundle로 import를 하지 않기 때문에 popperjs 모듈 설치 필요
- npm i @popperjs/core
// import bootstrap from 'bootstrap/dist/js/bootstrap.bundle';
import Dropdown from 'bootstrap/js/dist/dropdown';
const dropdownElementList = [].slice.call(
document.querySelectorAll('.dropdown-toggle')
);
dropdownElementList.map(function (dropdownToggleEl) {
return new Dropdown(dropdownToggleEl);
});