我正在使用 gruntjs 和 usemin 任务。 我将其添加到我的 html 文件中:
<!-- build:js scripts/all.js -->
<script src="../../core/module.js"></script>
<script src="../../core/base/alerts/alert-item.js"></script>
<script src="../../core/base/alerts/alerts-list.js"></script>
<script src="../../core/base/base_model.js"></script>
<script src="../../core/base/cursor.js"></script>
<script src="../../core/...<another script>...."></script>
<script src="../../core/...<another script>...."></script>
<script src="../../core/...<another script>...."></script>
<script src="../../core/...<another script>...."></script>
<!-- endbuild -->
如您所见,所有脚本都位于 ../../core
中,我如何告诉 usemin 首先采用 ../../core/module.js
然后 ../../core/**/*
而不提及每个文件?
这可能吗?
最佳答案
对于 grunt 任务配置,您可以使用全局模式动态构建文件列表。
查看 gruntjs 文档中关于“通配模式”和“动态构建文件对象”的两个连续段落: http://gruntjs.com/configuring-tasks#globbing-patterns
如果您粘贴 usimin 任务配置,它将可以帮助您构建正确的模式
关于javascript - 是否可以不提及grunt中的所有脚本文件路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20332676/