【问题标题】:HTML5 Boilerplate build scripts doesn't replace script tags in index.htmlHTML5 样板构建脚本不会替换 index.html 中的脚本标签
【发布时间】:2012-04-18 06:25:48
【问题描述】:

我刚刚开始使用 HTML5 样板构建脚本,但遇到了一些问题。基本上,我的所有脚本都按照我的希望进行了缩小和压缩,但是所有原始的<script> 标签都留在了输出index.html 中。我需要的是用对缩小的 js 文件的引用替换这些标签。我认为这应该默认发生。也许我做错了什么?

【问题讨论】:

    标签: javascript ant html5boilerplate


    【解决方案1】:

    我最终使用rakejavascript closure compiler 滚动了我自己的构建脚本。其实很简单。

    【讨论】:

      【解决方案2】:

      我猜负责替换的代码在build.xml文件目标-usemin尤其是this code中。

      1. 如果是这样,那么它会搜索标有//-beg- concat_js//-end- concat_js 的注释区域,正如quick start section 中所描述的那样。

      2. 还要确保您已将project.properties 文件中的file.root.script 属性设置为您真正使用的脚本(默认值应为main.js

      运行ant -debug >log.txt 对我有很大帮助。

      您可以通过searching through existing issues at GitHub 找到有用的答案,尤其是文章https://github.com/h5bp/ant-build-script/wiki/How-to-bypass-the-automatic-script-concatenation 似乎是roblarsen 对脚本连接问题的最终答案。

      我最终得到了运行 wintersmith 和 HTML5 Boilerplate 构建脚本的自定义 Node.js 构建脚本,对这些工具进行了一些配置并且它可以工作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-07-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-09-13
        • 1970-01-01
        相关资源
        最近更新 更多