<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 个异步任务

        时间:2024-04-19
        <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 个异步任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 CoffeeScript 中,是否有一种“官方"方法可以在运行时而不是在编译时插入字符串? 下一篇:Coffeescript 中的源映射 - 错误未映射到源

                  相关文章

                • <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>
                    <legend id='1XDYm'><style id='1XDYm'><dir id='1XDYm'><q id='1XDYm'></q></dir></style></legend>
                    <tfoot id='1XDYm'></tfoot>