What is “{.tmp,app} ” in Yeoman generator?

岁酱吖の 提交于 2019-12-05 14:05:06

问题


I am getting started with the Yeoman workflow, but I can't seem to completely understand the "alternate search path" for the usemin task in the index.html file. For example, there are 2 blocks generated with the 'yo angular' command:

<!-- build:js scripts/modules.js -->
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<!-- endbuild -->

vs.

<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>
<script src="scripts/directives/multiselect.js"></script>
<!-- endbuild -->

Why does the second one have the {.tmp, app} "alternate search path" (what does it mean)? Thanks in advance.


回答1:


<!-- build:js({.tmp,app}) scripts/scripts.js -->
<!-- endbuild -->

In yeoman js scripts are available in the app folder, but when the user is using CoffeeScript grunt task will convert .coffee files to .js files. Those generated .js files will be available in .tmp folder with the same folder structure.

In those condition ({.tmp,app}) is used to tell grunt-usemin to search both in app and .tmp folder, so that the build won't miss out generated js files.

scripts/scripts.js is the destination file after the build.



来源:https://stackoverflow.com/questions/20666273/what-is-tmp-app-in-yeoman-generator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!