Angular2-Cli Gives @Multi Styles Error

angular2-cli gives @multi styles error

Add ../ before path.

In angular-cli.json,

"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.scss"
]

Update

In angular7, there is angular.json file and you do not need to add ../ before path

Angular 2 Cli Issue while ng build --prod but if I use ng build only then it work's fine but size of app is too large

Based on the error message, I can assume that you forgot to use square brackets in the styles property either in .angular-cli.json or in one of your components.

When you run ng build --prod, it performs AOT by default. As per my experience, AOT compiler catches more errors than JiT. Try this experiment - turn off the AoT during the prod build:

ng build -prod -aot=false

Most likely you won't see any errors.

Angular.json Styles and Scripts doesn't work

Don't use the physical path, add relative path.

Try like this:

       "styles": [
"./node_modules/bootstrap/dist/css/bootstrap.css"
],
"scripts": [
"./node_modules/jquery/dist/jquery.js",
"./node_modules/bootstrap/dist/js/bootstrap.js",
]

angular2 - bootstrap-sass compilation error using angular-cli

After going through some research, I found solution here.

https://github.com/angular/angular-cli/issues/2170

I must set the icon path for glyphicons before importing bootstrap sass files. ie.

$icon-font-path: '~bootstrap-sass/assets/fonts/bootstrap/';

// Import bootstrap
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";


Related Topics



Leave a reply



Submit