在AJS应用程序中添加<base href =“/”/>

时间:2015-07-29 06:01:46

标签: angularjs twitter-bootstrap gruntjs

我无法在我的index.html的dist文件夹中添加以下内容:

 <base href="/"> 
头标记后

我怎么能用grunt任务呢?

参考:https://docs.angularjs.org/error/ $ location / nobase

1 个答案:

答案 0 :(得分:0)

You can use grunt-processhtml时,不要运行jQuery函数,只能在使用<base> - block template - 元素>

<!-- build:template
<base href="/">
/build -->

注意在使用grunt-processhtml处理文件之前,模板块是如何被注释掉的。如果要将href - 值更改为除根之外的其他值,您可以选择添加模板值。

<!-- build:template
<base href="/<%= basehref %>">
/build -->

配置:

  processhtml: {
    build: {
      options: {
        data: {
          basehref: ''
        }
      },
      files: {
        'dist/index.html': ['index.html']
      }
    }
  }