如何在 angular-cli 构建中包含自定义文件? [英] How to include custom files with angular-cli build?

查看:27
本文介绍了如何在 angular-cli 构建中包含自定义文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RE:Angular2 2.0.0,angular-cli v1.0.0-beta.11-webpack.8

RE: Angular2 2.0.0, angular-cli v1.0.0-beta.11-webpack.8

如何告诉 angular-cli 在构建时将来自src/assets"的文件包含在dist"的根目录中?

How do I tell angular-cli to include a file from "src/assets" in the root of "dist" when it builds?

我们部署到 Windows 主机,需要包含一个web.config"文件来告诉 IIS 将所有内容路由到索引.我们在 RC4 之前就做了这个,但随着所有的更新,它都失败了(我不记得我们是怎么做到的).

We deploy to a Windows host and need to include a "web.config" file to tell IIS to route everything to index. We were doing this pre RC4, but with all of the updating it fell through the cracks (I don't remember how we did it).

我一直在搜索 GitHub 存储库文档,但没有找到与此主题相关的任何内容.也许我来错地方了?

I've been scouring the GitHub repo docs and haven't found anything of use in regards to this topic. Maybe I'm in the wrong place?

ToC 中,有一个要点向构建中添加额外文件",但该部分似乎不存在.

In the ToC, there is a bullet point "Adding extra files to the build", but it appears that section doesn't exist.

推荐答案

资产"angular-cli.json 的属性可以配置为在 angular-cli webpack 构建中包含自定义文件.因此,配置资产"属性值作为数组.例如:

The "assets" property of angular-cli.json can be configured to include custom files in angular-cli webpack build. So, configure "assets" property value as an array. For example:

"assets": ["assets", "config.json",".htaccess"],

以上配置会在 angular-cli webpack 构建期间将 config.jon 和 .htaccess 复制到 dist 文件夹中.以上设置适用于 angular-cli 版本 1.0.0-beta.18

above configuration will copy config.jon and .htaccess into dist folder during the angular-cli webpack build. above setting worked in angular-cli version 1.0.0-beta.18

这篇关于如何在 angular-cli 构建中包含自定义文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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