Html5boilerplate HTML5样板文件构建脚本-子文件夹中的HTML和CSS/JS问题的相关链接
我的项目使用的是HTML5样板文件,包含在主根文件夹中引用/js和css/的HTML文件的子目录 例如: /article/xxx/index.html /article/yyy/index.html 这些.html文件与根文件夹中的css/js文件具有相对路径href/srcHtml5boilerplate HTML5样板文件构建脚本-子文件夹中的HTML和CSS/JS问题的相关链接,html5boilerplate,Html5boilerplate,我的项目使用的是HTML5样板文件,包含在主根文件夹中引用/js和css/的HTML文件的子目录 例如: /article/xxx/index.html /article/yyy/index.html 这些.html文件与根文件夹中的css/js文件具有相对路径href/src <link rel="stylesheet" href="../../css/style.css" /> <script src="../../js/plugins.js"></script
<link rel="stylesheet" href="../../css/style.css" />
<script src="../../js/plugins.js"></script>
<script src="../../js/script.js"></script>
但是没有骰子,CSS/JS路径会被替换,就像文件在根文件夹中一样,如下所示:
<link rel=stylesheet href='css/7d3586f292b65c896ef495e2e8ef042901d7c2e2.css'>
这显然不起作用。
如果有人知道这方面的解决方法/修改,或者这可能只是一个不可能的问题,我将非常感激
提前感谢您的帮助:D也许您可以尝试使用
file.pages = index.html, article/**/*.html
glob模式可能更符合构建脚本。我刚刚在一个空项目上测试了这一点,在article/fold1/
和article/fold2/
下使用index.html文件,两者的相对路径都与您的相同
我明白了
<link rel=stylesheet href='../../css/b218ab4.css'>
此外,更新文章文件夹下的html文件可能会让您省去一些麻烦,html模式将捕获这些目录中的所有html文件。您需要编辑build.xml脚本。在第630行附近,使用正则表达式替换对连接版本的js和css引用,但它不考虑子目录。我把那里的台词改成:
<echo message="Update the HTML to reference our concatenated script file: ${scripts.js}"/>
<!-- style.css replacement handled as a replacetoken above -->
<replaceregexp match="<!-- scripts concatenated [\d\w\s\W]*?src="([\d\w\s\W]*?)js/[\d\w\s\W]*?!-- end ((scripts)|(concatenated and minified scripts))-->" replace="<script defer src='\1${scripts.js}\'></script>" flags="m">
<fileset dir="${dir.intermediate}" includes="${page-files}"/>
</replaceregexp>
<!--[! use comments like this one to avoid having them get minified -->
<echo message="Updating the HTML with the new css filename: ${style.css}"/>
<replaceregexp match="<!-- CSS concatenated [\d\w\s\W]*?href="([\d\w\s\W]*?)css/[\d\w\s\W]*?!-- end CSS-->" replace="<link rel='stylesheet' href='\1${style.css}'>" flags="m">
<fileset dir="${dir.intermediate}" includes="${page-files}"/>
</replaceregexp>
保罗·爱尔兰(paul irish)自己回答说,试试谷歌HTML5样板组德国劳埃德船级社。应该解决这个问题。谢谢你的回答,但对我来说不太有效。不幸的是,对我来说。文章/xxx/中的html文件中的路径仍然错误。我会试着找出是否还有其他问题需要解决。
<echo message="Update the HTML to reference our concatenated script file: ${scripts.js}"/>
<!-- style.css replacement handled as a replacetoken above -->
<replaceregexp match="<!-- scripts concatenated [\d\w\s\W]*?src="([\d\w\s\W]*?)js/[\d\w\s\W]*?!-- end ((scripts)|(concatenated and minified scripts))-->" replace="<script defer src='\1${scripts.js}\'></script>" flags="m">
<fileset dir="${dir.intermediate}" includes="${page-files}"/>
</replaceregexp>
<!--[! use comments like this one to avoid having them get minified -->
<echo message="Updating the HTML with the new css filename: ${style.css}"/>
<replaceregexp match="<!-- CSS concatenated [\d\w\s\W]*?href="([\d\w\s\W]*?)css/[\d\w\s\W]*?!-- end CSS-->" replace="<link rel='stylesheet' href='\1${style.css}'>" flags="m">
<fileset dir="${dir.intermediate}" includes="${page-files}"/>
</replaceregexp>