Skip to content

Instantly share code, notes, and snippets.

@tesfayegari
Created July 15, 2019 17:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tesfayegari/e2b59f47a6ffc9f2b0bdcea3af03e67c to your computer and use it in GitHub Desktop.
Save tesfayegari/e2b59f47a6ffc9f2b0bdcea3af03e67c to your computer and use it in GitHub Desktop.
Add the following to the config.json Example below is using bootstrap 3.x but you can use any version
"externals": {
"jquery": {
"path": "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js",
"globalName": "jquery"
},
"bootstrap": {
"path": "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js",
"globalName": "bootstrap",
"globalDependencies": ["jquery"]
}
},
Import Statements
import { SPComponentLoader } from '@microsoft/sp-loader';
import 'jquery';
require('bootstrap');
Loading the CSS from CDN and start using Bootstrap.
let cssURL = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css";
SPComponentLoader.loadCss(cssURL);
Happy Coding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment