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

        <legend id='kpgkX'><style id='kpgkX'><dir id='kpgkX'><q id='kpgkX'></q></dir></style></legend>
      1. <small id='kpgkX'></small><noframes id='kpgkX'>

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

        当 gulp-jshint 失败时,无法使 gulp-notify 弹出错误消

        时间:2023-05-28
            <bdo id='86pgR'></bdo><ul id='86pgR'></ul>

            <small id='86pgR'></small><noframes id='86pgR'>

            1. <legend id='86pgR'><style id='86pgR'><dir id='86pgR'><q id='86pgR'></q></dir></style></legend>
                  <tbody id='86pgR'></tbody>
                <tfoot id='86pgR'></tfoot>

                <i id='86pgR'><tr id='86pgR'><dt id='86pgR'><q id='86pgR'><span id='86pgR'><b id='86pgR'><form id='86pgR'><ins id='86pgR'></ins><ul id='86pgR'></ul><sub id='86pgR'></sub></form><legend id='86pgR'></legend><bdo id='86pgR'><pre id='86pgR'><center id='86pgR'></center></pre></bdo></b><th id='86pgR'></th></span></q></dt></tr></i><div id='86pgR'><tfoot id='86pgR'></tfoot><dl id='86pgR'><fieldset id='86pgR'></fieldset></dl></div>
                • 本文介绍了当 gulp-jshint 失败时,无法使 gulp-notify 弹出错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  所以,我们整天都在研究新的 FE 工作流程,主要想法是通过观察者运行一些任务,我们将拥有我们的 IDE 和一个窗口,每次发生变化时都会刷新浏览器(scss、js, html 等).

                  So, was the whole day working on our new FE workflow, the main idea is to run a few tasks through a watcher, we will have our IDE's and a window with the browsers getting refreshed each time something change (scss, js, html, etc).

                  因此,如果一切顺利,我们将什么也看不到:浏览器将重新加载,我们将继续工作.

                  So, we wont see nothing if all went good: the browser will get reload and we will keep working.

                  但是,我们想使用 gulp notify 来处理错误,所以万一我们有问题,会弹出通知程序,此时您可以检查控制台并查看错误.

                  But, we want to use gulp notify for errors, so in case we have something wrong, the notifier pop up will appear, and at that point, you can check the console and see the error.

                  失败时的 sass 任务示例:

                  Example for our sass task when fail:

                  对于我们的样式任务,一切正常,但我无法为 JS 文件完成此操作.

                  For our styles tasks, everything works fine, but Im not able to accomplish this for JS files.

                  主要是,我不能让 gulp-jshint 像我想要的那样工作.

                  Mainly, I cant make gulp-jshint works as I want.

                  这将是这样的:你保存你的 js 文件,如果失败,弹出窗口,当你看到这个时,你进入控制台,你会看到 jshint-stylish 的输出.

                  Which will be like this: you save your js file, if it fails, the popup appear and when you see this, you go to the console and you see the output of jshint-stylish.

                  有人可以帮我吗?

                  这是我的(非工作)解决方案:

                  This is my (non working) solution:

                  gulp.task( 'js-hint', function() {
                      return gulp.src( config.source )
                          .pipe( plumber() )
                          .pipe( jshint( config.jsHintRules ) )
                          .pipe( jshint.reporter( 'jshint-stylish' ) )
                          .on('error', notify.onError( { message: 'JS hint fail' } ) );
                  });
                  

                  显然,我的概念有问题,所以,有人能帮我指明正确的方向吗?

                  Obviously, I have a problem with concepts, so, will somebody can please put me on the right direction ?

                  请注意,我只想一直发出相同的消息JS提示失败"

                  Note that I just want to emit the same message all the time "JS hint fail"

                  然后,控制台(感谢 jshint-stylish)将为我们提供更多信息.

                  Then, the console (thanks to jshint-stylish) will gave us more info.

                  此外,这将在一个观察者身上.JS提示通过后,会执行更多的任务,比如borwserify,所以重要的是如果它停止了,等待"直到我完成修复然后继续.

                  Also, this will be on a watcher. After JS hint pass, will execute more tasks, like borwserify, so its important that if its stop, "wait" till I finish fixing it and then keep going.

                  谢谢!

                  PS,我正在使用:

                  吞咽 3.8.10吞咽-jshint 1.8.6吞咽通知 2.0.1

                  gulp 3.8.10 gulp-jshint 1.8.6 gulp-notify 2.0.1

                  通过 OSX 10.9.4

                  Over a OSX 10.9.4

                  推荐答案

                  gulp 中的 error 事件仅在流中发生错误时触发.

                  The error event in gulp only fires when an error in the stream occurs.

                  要将错误报告器添加到 gulp-jshint 将其传递给 fail 报告器:

                  To add an error reporter to gulp-jshint pass it through the fail reporter:

                   gulp.task('js-hint', function() {
                        return gulp.src(config.source)
                          .pipe(plumber())
                          .pipe(jshint( config.jsHintRules))
                          .pipe(jshint.reporter('jshint-stylish'))
                          .pipe(jshint.reporter('fail'))
                          .on('error', notify.onError({ message: 'JS hint fail'}));
                    });
                  

                  这篇关于当 gulp-jshint 失败时,无法使 gulp-notify 弹出错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:我可以在同一个 React 代码库中同时使用 ES6 和 下一篇:尝试在 Chrome 中加载仪表板页面时避免使用 docu

                  相关文章

                  最新文章

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

                    <tfoot id='Vtn4O'></tfoot>

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