在Angular2我会
"outDir": "dist/app"
在Tconfig.json.结果,这件事被传开了.js和. map 文件在/dist/app/文件夹和/或其子文件夹中生成.这一切都很好.
在我的组件中.ts文件我也使用了像这样的html和css引用
@Component({
selector: 'my-app',
templateUrl: 'app/appshell/app.component.html',
styleUrls: ['app/appshell/app.component.css'],
......
}
有没有办法让编译器也为整个项目复制引用的html和css文件?
我在这里查看了https://www.typescriptlang.org/docs/handbook/compiler-options.html个编译器选项,但没有找到任何关于复制html/css文件的内容.
Update:
Root
|--app // for ts
|--dist/app // for js
tsconfig.json
"outDir": "dist/app"
包裹json
{
"name": "TestApp",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"html": "find ./app -name '*.html' -type f -exec cp --parents {} ./dist \\;",
......
}
它不会复制html文件.不过没有错误.
Update again:
对于那些使用Linux操作系统的人来说,Bernardo的解决方案是可行的.
"scripts": {
"html": "XCOPY /S /y .\\app\\*.html .\\dist\\app" }