[英]HTML5 Boilerplate build scripts doesn't replace script tags in index.html
I am just getting started with the HTML5 boilerplate build script and I am having some problems. 我刚开始使用HTML5样板构建脚本,但遇到了一些问题。 Basically all my scripts are minified and compressed as I would hope, but all of the original
<script>
tags are left in the output index.html
. 基本上,所有脚本都按照我的期望进行了缩小和压缩,但是所有原始
<script>
标记都保留在输出index.html
。 What I need is for it to replace these tags with a reference to the minified js file. 我需要的是用对缩小的js文件的引用替换这些标签。 I thought this should happen by default.
我认为这应该默认发生。 Maybe I am doing something wrong?
也许我做错了什么?
I ended up rolling my own build script with rake and the javascript closure compiler . 我最终使用rake和javascript闭合编译器滚动了自己的构建脚本。 It was pretty easy actually.
实际上,这很容易。
I guess the code responsible for replacing is in the build.xml
file target -usemin
especially this code . 我猜负责替换的代码在
build.xml
文件target -usemin
尤其是此代码 。
If it is so then it searches for comment region marked with //-beg- concat_js
and //-end- concat_js
as is described as must-have in the quick start section . 如果是这样,则它将搜索标记为
//-beg- concat_js
和//-end- concat_js
//-beg- concat_js
注释区域,如快速 //-end- concat_js
部分所述 。
Also make sure that you have set the file.root.script
property in the project.properties
file to the script you really use (default value expects main.js
) 还要确保已将
project.properties
文件中的file.root.script
属性设置为您真正使用的脚本(默认值期望为main.js
)
Running ant -debug >log.txt
helps me a lot. 运行
ant -debug >log.txt
对我有很大帮助。
You can find helpful answer by searching through existing issues at GitHub , especially the article https://github.com/h5bp/ant-build-script/wiki/How-to-bypass-the-automatic-script-concatenation seems to be roblarsen's final answer to script concatenation problems. 您可以通过在GitHub上搜索现有问题来找到有用的答案,尤其是https://github.com/h5bp/ant-build-script/wiki/How-to-bypass-the-automatic-script-concatenation这篇文章roblarsen对脚本串联问题的最终答案。
I ended up with my custom Node.js build script that runs wintersmith and HTML5 Boilerplate build script, does some configuration of those tools and it works. 最后,我完成了运行Wintersmith和HTML5 Boilerplate构建脚本的自定义Node.js构建脚本, 并对这些工具进行了一些配置,并且该脚本可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.