Using Angular-cli, I'm trying to reference bootstrap.css
index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Title</title>
<base href="/">
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
...
</head>
<body> Angular-cli auto generated code </body>
<html>
package.json
"dependencies": {
"bootstrap": "4.0.0-alpha.2"
}
Now i understand that ng build
creates a dist
project and in vendor
folder
Are all the includes that are needed, And I've managed to add to the vendor
folder the bootstrap file by:
system-config.js
// Apply the CLI SystemJS configuration.
System.config({
map: {
...
'bootstrap': 'vendor/bootstrap/dist/css/bootstrap.css'
},
packages: cliSystemConfigPackages
});
and angular-cli-build.js
module.exports = function(defaults) {
return new Angular2App(defaults, {
vendorNpmFiles: [
...
'bootstrap/dist/css/bootstrap.css'
]
});
};
But still The server couldn't find bootstrap.css
Notes
- I'm not looking for a
CDN
solution, I want to understand how to import things fromnode_modules
- Not looking for `ng2 angular directives so this question is not really a valid solution