【问题标题】:Is this possible to change script path in index.html file after build completed?构建完成后是否可以更改 index.html 文件中的脚本路径?
【发布时间】:2019-01-02 07:08:35
【问题描述】:

我有一个 angular-cli 应用程序,当我发出 ng build 命令时,它会创建包含 index.html 文件的构建文件。

在 index.html 文件中,脚本路径如下所示:

<script type="text/javascript" **src="runtime.js"**></script>
<script type="text/javascript" **src="polyfills.js"**></script>
<script type="text/javascript" **src="styles.js"**></script>
<script type="text/javascript" **src="vendor.js"**></script>
<script type="text/javascript" **src="main.js"**></script>

但我想像下面那样更改该脚本,

<script type="text/javascript" **src="~/runtime.js"**></script>
<script type="text/javascript" **src="~/polyfills.js"**></script>
<script type="text/javascript" **src="~/styles.js"**></script>
<script type="text/javascript" **src="~/vendor.js"**></script>
<script type="text/javascript" **src="~/main.js"**></script>

不使用查找和替换方法是否可以更改路径?

【问题讨论】:

    标签: angular-cli angular-cli-v7


    【解决方案1】:

    我在这里 [Modify the src location for javascript script tags during ng build] 找到了我的问题的答案。

    请看这里

    "deployUrl": "/app/",这个属性可以帮助我实现我的要求

    【讨论】:

      猜你喜欢
      • 2018-08-03
      • 2018-02-24
      • 2019-04-05
      • 1970-01-01
      • 2012-05-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多