Angular 6在angular.json中加载css文件夹 [英] Angular 6 load css folders in angular.json

查看:183
本文介绍了Angular 6在angular.json中加载css文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将html模板转换为有角度的应用程序.我有一个名为plugins和img文件夹的css文件夹.

I am trying to convert my html template into angular app. I have a css folder called plugins and img folder.

当我添加时:

 "styles": [
          "src/assets/plugins/listtyicons/style.css",
          "src/assets/plugins/jquery-ui/jquery-ui.min.css",
          "src/assets/plugins/bootstrap/css/bootstrap.min.css",
          "src/assets/plugins/plugins/isotope/isotope.min.css",
          "src/styles.css"

        ]

angular.json文件中的这段代码尝试启动angular app时出现错误.我已将我的插件文件夹放入素材资源文件夹中.我收到此错误:

this code in angular.json file I am getting error when trying to start angular app. I have put my plugin folder inside assets folder. I am getting this error:

 ERROR in multi ./src/assets/plugins/listtyicons/style.css 
./src/assets/plugins/jquery-ui/jquery-ui.min.css ./src/assets/plugins/bootstrap/css/bootstrap.min.css ./src/assets/plugins/plugins/isotope/isotope.min.css ./src/styles.css
Module not found: Error: Can't resolve 
'/Users/nilay/angular/bes/src/assets/plugins/plugins/isotope/isotope.min.css' 
in '/Users/nilay/angular/bes'

我不知道为什么会收到此错误.

I don't know why am I getting this error.

推荐答案

角度6 中,您必须在src/style.css中添加 only (而不是angular.json):

In angular 6 you have to add only in src/style.css (instead angular.json):

@import "assets/plugins/listtyicons/style.css";
@import "assets/plugins/jquery-ui/jquery-ui.min.css";
@import "assets/plugins/bootstrap/css/bootstrap.min.css";
@import  "assets/plugins/plugins/isotope/isotope.min.css";

angular.json

"styles": [
          "src/styles.css"
        ]

这篇关于Angular 6在angular.json中加载css文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆