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

查看:58
本文介绍了如何在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在"dist"的根目录中包含来自"src/assets"的文件?

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的"assets"属性可以配置为在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.jsn和.htaccess复制到dist文件夹中.以上设置适用于angular-cli版本1.0.0-beta.18

above configuration will copy config.jsn 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天全站免登陆