使用yeoman 主干生成器时,我不清楚 grunt 任务是如何工作的。
- 从哪里
grunt server
运行应用程序?它似乎从 .tmp 文件夹运行。 - 从哪里
grunt server:dist
运行应用程序?它似乎从 dist 文件夹运行,但在我的情况下,该应用程序无法正确启动。它正在尝试require
未找到的 HomePage.js。 - 从哪里
grunt server:test
跑?它运行“watch:livereload”,然后不启动浏览器。
使用yeoman 主干生成器时,我不清楚 grunt 任务是如何工作的。
grunt server
运行应用程序?它似乎从 .tmp 文件夹运行。grunt server:dist
运行应用程序?它似乎从 dist 文件夹运行,但在我的情况下,该应用程序无法正确启动。它正在尝试require
未找到的 HomePage.js。grunt server:test
跑?它运行“watch:livereload”,然后不启动浏览器。当你使用 时grunt server
,你从 app/ 目录运行你的应用程序。app/ 是你的纯的、非编译的、非缩小的源代码所在的地方。您无需更改 .tmp/ 中的任何内容
使用 时grunt server:dist
,您从 app/ 构建应用程序到 dist/ 并从 dist/ 运行它。dist/ 是您的可分发应用程序。如果你有一个 js 错误grunt server:dist
并且grunt server
不确定你把你的 js 链接放在
<!-- build:js({.tmp,app}) scripts/main.js -->
<script src="scripts/main.js"></script>
<script src="scripts/templates.js"></script>
<script src="scripts/HomePage.js"></script>
<!-- endbuild -->
因为构建过程将连接所有这些文件并构建一个新文件(scripts/main.js),而不会将 app/scripts 的内容复制到 dist/scripts。
grunt server:test
从应用程序运行,基本上可以为您的测试框架 Mocha 创建和服务您的应用程序,以执行您的测试。这不会启动浏览器,因为它只为您的测试框架提供应用程序。
资料来源: http: //net.tutsplus.com/tutorials/javascript-ajax/building-apps-with-the-yeoman-workflow/