Can angular cli use flag icon css?

扶醉桌前 提交于 2020-01-23 06:34:12

问题


I am beginner in angular cli and I was wondering: can I use this https://github.com/lipis/flag-icon-css in package.json because when there is an update it's more easy to update automatically and I don't have to do it manually. And is it a problem that Flag icon are SCSS and I use SASS in my angular 2 project?


回答1:


Yes it can do,

Using the package from node_modules works just fine. You'll just have to override all paths.

I've got this in my style.scss.

$flag-icon-css-path: '~flag-icon-css/flags' !default;
@import "~flag-icon-css/sass/flag-icon";

$image_path: '~material-design-lite/src/images' !default;
@import "~material-design-lite/src/material-design-lite";



回答2:


Installation:

npm install flag-icon-css --save

Updating the styles section in the angular.json file (if you use Angular < 6.0.0 - then angular-cli.json):

"styles": [
    "node_modules/flag-icon-css/css/flag-icon.min.css",
    .....
],

Use in templates:

<span class="flag-icon flag-icon-ru"></span>


来源:https://stackoverflow.com/questions/42275057/can-angular-cli-use-flag-icon-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!