Bootstrap Installation for SharePoint Developers step by step
how we can download and install bootstrap in SPFX web parts?
There are different ways we can
download and use bootstrap.
1) We can download the compiled
version of CSS and JS required for bootstrap and we can use it.
https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css
https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js
Add this file in Assets folder of your solution and require n your
tsx.
2) you can also provide the JS and CSS file path from CDN path like below: <SPComponentLoader.loadCss('https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css’)>
<SPComponentLoader.Script(‘https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js’)>
3)You can install bootstrap using the npm command in your
solution.
Run this command in your terminal
npm i bootstrap
by using the above method, you can start using bootstrap
in the SPFX web part.
Problems encountered while utilizing Bootstrap:
· Failed to locate files The cause of the problem is that we did not utilize a file in the bootstrap folder structure or we used the incorrect file location.
· A common issue is that when it comes to bootstrap versions, we should stick to a single version and follow the documentation for that version.
· We shouldn't utilize the CDN path because it will take some time and occasionally cause redirection problems.
· JavaScript not working in modal popup components because jQuery isn't installed or there's a jQuery version problem.
- Janmeet
Comments
Post a Comment