angular2 - bootstrap-sass compilation error using angular-cli -
i using angular-cli: 1.0.0-beta.19-3 node: v5.11.1
in angular-cli.json file, have set global style file extension .scss.
here styles file.
angular2/src/styles.scss
// default font @import url(https://fonts.googleapis.com/css?family=raleway:300,400,600); // typography $font-family-sans-serif: "raleway", sans-serif; $font-size-base: 14px; $line-height-base: 1.6; $text-color: #636b6f; // import bootstrap @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
errors spits out when try import bootrap-sass modules, gives error associated glyphicon icons. don't know how resolve it.
error in ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/styles.scss module not found: error: can't resolve '../fonts/bootstrap/glyphicons-halflings-regular.eot' in '/var/www/angular/src' @ ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/styles.scss 6:4253-4315 6:4338-4400 @ ./src/styles.scss @ multi styles error in ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/styles.scss module not found: error: can't resolve '../fonts/bootstrap/glyphicons-halflings-regular.woff2' in '/var/www/angular2/src' @ ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/styles.scss 6:4452-4516 @ ./src/styles.scss @ multi styles error in ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/styles.scss module not found: error: can't resolve '../fonts/bootstrap/glyphicons-halflings-regular.woff' in '/var/www/angular2/src' @ ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/styles.scss 6:4549-4612 @ ./src/styles.scss @ multi styles error in ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/styles.scss module not found: error: can't resolve '../fonts/bootstrap/glyphicons-halflings-regular.ttf' in '/var/www/angular2/src' @ ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/styles.scss 6:4644-4706 @ ./src/styles.scss @ multi styles error in ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/styles.scss module not found: error: can't resolve '../fonts/bootstrap/glyphicons-halflings-regular.svg' in '/var/www/angular2/src' @ ./~/css-loader!./~/postcss-loader!./~/sass-loader!./src/styles.scss 6:4742-4804 @ ./src/styles.scss @ multi styles
after going through research, found solution here.
https://github.com/angular/angular-cli/issues/2170
i must set icon path 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";
Comments
Post a Comment