我想在规格中加入实质性的CSS。在业力配置中出现这样的内容之前:
files: [
// make sure material styles are served
{ pattern: './node_modules/@angular/material/prebuilt-themes/indigo-pink.css', watched: true, included: true, served: true },
{ pattern: './src/test.ts', watched: false }
]
但是新项目在业力配置中不再具有files属性。
我尝试将其添加到angular.json中,但是它不起作用:
"test": {
...
"options": {
"main": "src/test.ts",
...
"karmaConfig": "src/karma.conf.js",
"styles": [
"node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
有什么想法怎么做?
答案 0 :(得分:0)
没关系,路径错误这有效(业力配置):
files: [
// make sure angular material styles are served
{ pattern: '../node_modules/@angular/material/prebuilt-themes/indigo-pink.css', watched: true, included: true, served: true },
]
答案 1 :(得分:0)
我的文件在url的完整路径之外提供。 http://localhost:9876/Users/david/myapp/src/test/data/pages/table.html
解决方案是使用url中的单词“ base”访问文件
http://localhost:9876/base/test/data/pages/table.html
files: [{pattern: 'test/data/pages/**.html', watched: true, served: true, included: false, nocache: true}]