concept Bootstrap in category aurelia

This is an excerpt from Manning's book Aurelia in Action.
An unsupported version of npm. To use frontend dependencies such as Bootstrap, which are installed via the Aurelia CLI, you’ll need a flat directory structure for your installed packages. The flat directory structure was not supported until npm 3, so it’s recommended that you update to this version before creating new projects with the Aurelia CLI. You can check which npm version you’ve got installed using the npm -v command. If it shows 3.x or greater, you’re good to go. If not, then you can update to the latest version of npm using the npm install npm -g command.
Next, you’ll need to reference jQuery and Bootstrap to include these in the vendor-bundle. Add the dependences shown in listing A.1 to the end of the dependencies section. The Aurelia CLI will have added Bootstrap Aurelia, so you’ll need to remove that, adding these lines instead. You can cross-check this file against the gist here: http://mng.bz/9Uk7.
Listing A.1. Modified configuration to include Bootstrap library (aurelia.json)
... }, "jquery", #1 { "name": "bootstrap", #2 "path": "../node_modules/bootstrap/dist", #3 "main": "js/bootstrap.bundle.min.js", #4 "deps": [ #5 "jquery" ], "exports": "$", #6 "resources": [ #7 "css/bootstrap.css" #8 ] }, ... ]With legacy style dependencies, such as Bootstrap, you need to give the bundling system more information as to how it should handle the items (CSS, JavaScript) that need to be included. Key points to note from listing A.1 are that you provide a specific path where the bundler should look for the Bootstrap source code (relative to your application src directory), and where the main module of that package is found (this is what you’ll import when using the Bootstrap JavaScript plugins). You also indicated the value this main module should be exported as (in this case, $). This allows you to import the main module from bootstrap.min into a view-model using the import $ from bootstrap syntax. Finally, the Bootstrap library includes CSS, which, being text, isn’t traceable as part of the module system; you need to list it in the resources array so that it will be injected as text into the vendor-bundle.
So far, you’ve completed the required steps to use the Bootstrap styles in your application by referencing the stylesheet from one of your views. To use any of the JavaScript components (such as the Tooltip) however, one more step is required. You’ll need to modify the app.js view-model file to import Bootstrap.
Listing A.2. Importing Bootstrap into your app view-model (app.js)
import 'bootstrap'; #1 export class App { configureRouter(config, router) { this.router = router; config.title = 'My-Books'; config.map([ { route: ['', 'home'], name: 'home', moduleId: 'index' }, { route: 'books', name: 'books', moduleId: './resources/elements/books'}, ]); } }