Skip to content

Commit 000c694

Browse files
committed
chore(docs): add global lib docs
1 parent 22a6b59 commit 000c694

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The generated project has dependencies that require **Node 4 or greater**.
4646
* [Commands autocompletion](#commands-autocompletion)
4747
* [CSS preprocessor integration](#css-preprocessor-integration)
4848
* [3rd Party Library Installation](#3rd-party-library-installation)
49+
* [Global Library Installation](#global-library-installation)
4950
* [Updating angular-cli](#updating-angular-cli)
5051
* [Known Issues](#known-issues)
5152
* [Development Hints for hacking on angular-cli](#development-hints-for-hacking-on-angular-cli)
@@ -287,6 +288,34 @@ npm install moment --save
287288
npm install @types/moment --save-dev
288289
```
289290

291+
### Global Library Installation
292+
293+
Some javascript libraries need to be added to the global scope, as if they were
294+
loaded via a script tag. We can do this by manually adding these libraries to `window`.
295+
296+
As an example, to install Boostrap 4 this is what you need to do:
297+
298+
First install the needed libraries from `npm`:
299+
300+
```bash
301+
npm install jquery tether bootstrap@next
302+
```
303+
304+
Then update `styles.css` by importing the `Bootstrap` styles:
305+
```
306+
@import '../node_modules/bootstrap/dist/css/bootstrap.css';
307+
```
308+
309+
Then add the following to `src/scripts.ts`.
310+
311+
```
312+
window['jQuery'] = require('jquery')
313+
window['Tether'] = require('tether')
314+
require('bootstrap/dist/js/bootstrap');
315+
```
316+
317+
Now Bootstrap 4 should be working on your app.
318+
290319
### Updating angular-cli
291320

292321
To update `angular-cli` to a new version, you must update both the global package and your project's local package.

addon/ng2/blueprints/ng2/files/__path__/main.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import './scripts';
2+
13
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
24
import { enableProdMode } from '@angular/core';
35
import { AppModule, environment } from './app/';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Here you can add some additional Typescript code you need to run before your app

0 commit comments

Comments
 (0)