Angular 2 Typescript编译器复制html和css文件

在Angular2我会有
"outDir": "dist/app"

在tsconfig.json.因此,在/ dist / app /文件夹和/或其子文件夹中生成了.iled和.map文件.这一切都很好.

在我的components.ts文件中,我也使用了这样引用的html和css

@Component({
  selector: 'my-app',templateUrl: 'app/appshell/app.component.html',styleUrls: ['app/appshell/app.component.css'],......
}

有没有办法使编译器也复制整个项目的引用的html和css文件
如果是,我该如何配置我的tsconfig.json?

我查看了这里的编译器选项https://www.typescriptlang.org/docs/handbook/compiler-options.html,但没有找到有关复制html / css文件的任何内容.

更新:
我的文件夹结构是这样的

Root
  |--app       // for ts
  |--dist/app  // for js

tsconfig.json

"outDir": "dist/app"

的package.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文件.没有错误.

再次更新:

对于那些在Linux操作系统上的人来说,Bernardo的解决方案是一个工作的解决方案.
对于那些在Windows操作系统上的人来说,以下应该是正常的.

"scripts": {
    "html": "XcopY /S /y .\\app\\*.html .\\dist\\app" }
不,TypeScript编译器只适用于* .ts文件.

您必须使用复制方法(例如cpm shell命令)复制其他文件,如* .html和* .css,例如npm脚本或grunt-contrib-copy.

使用npm脚本的示例:

"scripts": {
  "html": "find ./app -name '*.html' -type f -exec cp --parents {} ./dist \\;"
}

只需运行npm在shell中运行html.

使用grunt的例子:

copy: {
      html: {
          src: ['**/*.html'],dest: 'dist',cwd: 'app',expand: true,}
}

相关文章

ANGULAR.JS:NG-SELECTANDNG-OPTIONSPS:其实看英文文档比看中...
AngularJS中使用Chart.js制折线图与饼图实例  Chart.js 是...
IE浏览器兼容性后续前言 继续尝试解决IE浏览器兼容性问题,...
Angular实现下拉菜单多选写这篇文章时,引用文章地址如下:h...
在AngularJS应用中集成科大讯飞语音输入功能前言 根据项目...
Angular数据更新不及时问题探讨前言 在修复控制角标正确变...