<tfoot id='ehFEn'></tfoot>

      • <bdo id='ehFEn'></bdo><ul id='ehFEn'></ul>

    1. <i id='ehFEn'><tr id='ehFEn'><dt id='ehFEn'><q id='ehFEn'><span id='ehFEn'><b id='ehFEn'><form id='ehFEn'><ins id='ehFEn'></ins><ul id='ehFEn'></ul><sub id='ehFEn'></sub></form><legend id='ehFEn'></legend><bdo id='ehFEn'><pre id='ehFEn'><center id='ehFEn'></center></pre></bdo></b><th id='ehFEn'></th></span></q></dt></tr></i><div id='ehFEn'><tfoot id='ehFEn'></tfoot><dl id='ehFEn'><fieldset id='ehFEn'></fieldset></dl></div>

      <small id='ehFEn'></small><noframes id='ehFEn'>

      <legend id='ehFEn'><style id='ehFEn'><dir id='ehFEn'><q id='ehFEn'></q></dir></style></legend>

        使用 grunt 运行 2 个异步任务

        Running 2 async tasks with grunt(使用 grunt 运行 2 个异步任务)
        <i id='eEwrx'><tr id='eEwrx'><dt id='eEwrx'><q id='eEwrx'><span id='eEwrx'><b id='eEwrx'><form id='eEwrx'><ins id='eEwrx'></ins><ul id='eEwrx'></ul><sub id='eEwrx'></sub></form><legend id='eEwrx'></legend><bdo id='eEwrx'><pre id='eEwrx'><center id='eEwrx'></center></pre></bdo></b><th id='eEwrx'></th></span></q></dt></tr></i><div id='eEwrx'><tfoot id='eEwrx'></tfoot><dl id='eEwrx'><fieldset id='eEwrx'></fieldset></dl></div>

          <small id='eEwrx'></small><noframes id='eEwrx'>

            <tfoot id='eEwrx'></tfoot>

                <bdo id='eEwrx'></bdo><ul id='eEwrx'></ul>

              • <legend id='eEwrx'><style id='eEwrx'><dir id='eEwrx'><q id='eEwrx'></q></dir></style></legend>
                  <tbody id='eEwrx'></tbody>

                  本文介绍了使用 grunt 运行 2 个异步任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个小型节点项目,我使用咖啡脚本而不是客户端代码.我正在尝试使用 grunt 设置我的开发环境.我已经为运行这样的服务器实现了自定义 grunt 任务:

                  I am working on a small node project and I use coffeescript and less for client-side code. I am trying to set up my development environment using grunt. I've implemented custom grunt task for running server like this:

                  start = require './start' #just a function to start express.js application
                  grunt.registerTask 'server', 'Starting server', ->
                      grunt.log.write 'Preparing server to start'
                      done = do @async
                      start (err) ->
                          grunt.log.write "server running at localhost:4000"
                  

                  我还想使用 grunt-contrib-watch 插件运行监视"任务:

                  I also want to run the "watch" task using grunt-contrib-watch plugin:

                  grunt.initConfig
                      watch:
                          coffee:
                              files: ['public/coffee/**/*.coffee']
                              tasks: ['coffee']
                          jade:
                              files: ['public/jade/**/*.jade']
                              tasks: ['jade']
                          less:
                              files: ['public/less/**/*.less']
                              tasks: ['less']
                  

                  问题是:如何让这两个任务(watch和server)同时运行?我想让服务器启动并运行,并且不想在每次更改某些客户端代码时重新加载它.提前致谢

                  The question is: How to make this two tasks (watch and server) run simultaneously? I want to have a server up and running and don't want to reload it every time some client-side code is changed. Thanks in advance

                  推荐答案

                  给你的watch任务加前缀,去掉服务器任务里面的done = do @async.

                  Prefix it to your watch tasks, and get rid of the done = do @async inside the server task.

                  任务:['server', 'coffee']

                  您想在 Grunt 配置中指定一个选项,以使服务器任务长时间运行".然后你可以调用 @async 只有当你需要它长时间运行(没有监视任务).

                  You want to specify an option in your Grunt configuration for the server task to be "long-running" or not. Then you can call @async only if you need it to be long running (without the watch task).

                  这篇关于使用 grunt 运行 2 个异步任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  Rails 3.1 ajax:success handling(Rails 3.1 ajax:成功处理)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)
                • <small id='1XDYm'></small><noframes id='1XDYm'>

                        <bdo id='1XDYm'></bdo><ul id='1XDYm'></ul>

                        <i id='1XDYm'><tr id='1XDYm'><dt id='1XDYm'><q id='1XDYm'><span id='1XDYm'><b id='1XDYm'><form id='1XDYm'><ins id='1XDYm'></ins><ul id='1XDYm'></ul><sub id='1XDYm'></sub></form><legend id='1XDYm'></legend><bdo id='1XDYm'><pre id='1XDYm'><center id='1XDYm'></center></pre></bdo></b><th id='1XDYm'></th></span></q></dt></tr></i><div id='1XDYm'><tfoot id='1XDYm'></tfoot><dl id='1XDYm'><fieldset id='1XDYm'></fieldset></dl></div>
                          <tbody id='1XDYm'></tbody>
                        <legend id='1XDYm'><style id='1XDYm'><dir id='1XDYm'><q id='1XDYm'></q></dir></style></legend>
                        <tfoot id='1XDYm'></tfoot>