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

      1. <small id='TVF76'></small><noframes id='TVF76'>

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

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

        如何调试 Gulp 任务?

        时间:2023-05-27

          <bdo id='oCCk3'></bdo><ul id='oCCk3'></ul>
        • <small id='oCCk3'></small><noframes id='oCCk3'>

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

                • <tfoot id='oCCk3'></tfoot>
                • 本文介绍了如何调试 Gulp 任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  如何使用诸如 Google Chrome 调试器之类的调试器来调试在我的 gulpfile.js 中定义的 gulp 任务,逐行执行任务的代码?

                  How do I debug a gulp task defined in my gulpfile.js with a debugger such as the Google Chrome debugger, stepping through the task's code line by line?

                  推荐答案

                  使用 Node.js 6.3+ 版本,您可以使用 --inspect flag 在运行你的任务时.

                  With Node.js version 6.3+ you can use the --inspect flag when running your task.

                  调试名为 css 的 gulp 任务:

                  To debug a gulp task named css:

                  1. 找出你的 gulp 可执行文件在哪里.如果 gulp 安装在本地,它将位于 node_modules/.bin/gulp.如果 gulp 已全局安装,请在终端中运行 which gulp (Linux/Mac) 或 where gulp (Windows) 以找到它.

                  1. Find out where your gulp executable lives. If gulp is installed locally, this will be at node_modules/.bin/gulp. If gulp is installed globally, run which gulp (Linux/Mac) or where gulp (Windows) in a terminal to find it.

                  根据您的 Node.js 版本运行这些命令之一.如果需要,请将 ./node_modules/.bin/gulp 替换为步骤 1 中 gulp 安装的路径.

                  Run one of these commands according to your version of Node.js. If required, replace ./node_modules/.bin/gulp with the path to your gulp installation from step 1.

                  • Node.js 6.3+:node --inspect --debug-brk ./node_modules/.bin/gulp css
                  • Node.js 7+:node --inspect-brk ./node_modules/.bin/gulp css

                  使用 Chrome 浏览到 chrome://inspect.

                  Use Chrome to browse to chrome://inspect.

                  --debug-brk (Node.js 6.3+) 和 --inspect-brk (Node.js 7+) 标志用于暂停代码执行在任务的第一行代码上.这让您有机会在任务完成之前打开 Chrome 调试器并设置断点.

                  The --debug-brk (Node.js 6.3+) and --inspect-brk (Node.js 7+) flags are used to pause code execution on the first line of code of your task. This gives you a chance to open up the Chrome debugger and set breakpoints before the task finishes.

                  如果您不希望调试器在第一行代码处暂停,只需使用 --inspect 标志.

                  If you don't want the debugger to pause on first line of code, just use the --inspect flag.

                  您还可以安装 Node.js Inspector Manager (NIM) Chrome 扩展以帮助完成第 3 步.这将自动打开一个 Chrome 选项卡,调试器已准备就绪,作为手动浏览 URL 的替代方法.

                  You can also install the Node.js Inspector Manager (NIM) extension for Chrome to help with step 3. This will automatically open up a Chrome tab with the debugger ready to go, as an alternative to manually browsing to a URL.

                  这篇关于如何调试 Gulp 任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 Gulp 中使用 Browserify 丑化输出? 下一篇:Gulp 错误:找不到模块 'jshint/src/cli'

                  相关文章

                  最新文章

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

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

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