-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaks when logError tries to emit the end event #680
Comments
What is $?
…On Fri., 6 Apr. 2018, 7:31 pm Daniel Kvistgaard, ***@***.***> wrote:
The logError function breaks the Gulp task as it tries to emit an end
event.
After changing the logError function to an arrow function it has lost it's
correct reference to the this operator, which causes it to break.
Instead of being a reference to the stream the this operator in this
setup is a reference to gulpSass.
*Versions*
- gulp 3.9.1
- gulp-sass 4.0.0
- npm 5.8.0
- node 8.9.1
*Gulp Task*
gulp.task('styles', () => {
return gulp.src('app/styles/style.scss')
.pipe($.sass().on('error', $.sass.logError))
.pipe(gulp.dest('dist/styles'));
});
*Error Message*
/node_modules/gulp-sass/index.js:156
this.emit('end');
^
TypeError: this.emit is not a function
at DestroyableTransform.gulpSass.logError (/node_modules/gulp-sass/index.js:156:8)
at emitOne (events.js:121:20)
at DestroyableTransform.emit (events.js:211:7)
at onwriteError (/node_modules/readable-stream/lib/_stream_writable.js:354:10)
at onwrite (/node_modules/readable-stream/lib/_stream_writable.js:371:11)
at WritableState.onwrite (/node_modules/readable-stream/lib/_stream_writable.js:126:5)
at afterTransform (/node_modules/readable-stream/lib/_stream_transform.js:81:3)
at TransformState.afterTransform (/node_modules/readable-stream/lib/_stream_transform.js:58:12)
at errorM (/node_modules/gulp-sass/index.js:118:12)
at Object.callback (/node_modules/gulp-sass/index.js:127:16)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#680>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjZWIcmg5F9BUJNLuAHKIpJvy7lj6Wsks5tlzYMgaJpZM4TJxA4>
.
|
I see. Yes there is a bug in gulp-sass 4. I'm not at a computer. I can make
a patch in 24hrs
…On Fri., 6 Apr. 2018, 8:17 pm Michael Mifsud, ***@***.***> wrote:
What is $?
On Fri., 6 Apr. 2018, 7:31 pm Daniel Kvistgaard, ***@***.***>
wrote:
> The logError function breaks the Gulp task as it tries to emit an end
> event.
>
> After changing the logError function to an arrow function it has lost
> it's correct reference to the this operator, which causes it to break.
> Instead of being a reference to the stream the this operator in this
> setup is a reference to gulpSass.
>
> *Versions*
>
> - gulp 3.9.1
> - gulp-sass 4.0.0
> - npm 5.8.0
> - node 8.9.1
>
> *Gulp Task*
>
> gulp.task('styles', () => {
> return gulp.src('app/styles/style.scss')
> .pipe($.sass().on('error', $.sass.logError))
> .pipe(gulp.dest('dist/styles'));
> });
>
> *Error Message*
>
> /node_modules/gulp-sass/index.js:156
> this.emit('end');
> ^
>
> TypeError: this.emit is not a function
> at DestroyableTransform.gulpSass.logError (/node_modules/gulp-sass/index.js:156:8)
> at emitOne (events.js:121:20)
> at DestroyableTransform.emit (events.js:211:7)
> at onwriteError (/node_modules/readable-stream/lib/_stream_writable.js:354:10)
> at onwrite (/node_modules/readable-stream/lib/_stream_writable.js:371:11)
> at WritableState.onwrite (/node_modules/readable-stream/lib/_stream_writable.js:126:5)
> at afterTransform (/node_modules/readable-stream/lib/_stream_transform.js:81:3)
> at TransformState.afterTransform (/node_modules/readable-stream/lib/_stream_transform.js:58:12)
> at errorM (/node_modules/gulp-sass/index.js:118:12)
> at Object.callback (/node_modules/gulp-sass/index.js:127:16)
>
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#680>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAjZWIcmg5F9BUJNLuAHKIpJvy7lj6Wsks5tlzYMgaJpZM4TJxA4>
> .
>
|
@xzyfer Oh yeah Ok great. Let me know if you need me to create a PR or need any further info. |
Happy to accept a PR with a test 😀
If you look at the logError function at the bottom of the file. It's been
mistakenly converted to an unbounded arrow function. That's why this is not
defined.
…On Fri., 6 Apr. 2018, 9:03 pm Daniel Kvistgaard, ***@***.***> wrote:
Oh yeah $ is a reference to all gulp plugins loaded in with
gulp-load-plugins. Just so we don't have to write a require statement for
each gulp plugin in our gulpfile. :)
Ok great. Let me know if you need me to create a PR or need any further
info.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#680 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjZWDiBsNrQPoaToosRHlyW3RiOsHEJks5tl0uNgaJpZM4TJxA4>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
logError
function breaks the Gulp task as it tries to emit an end event.After changing the
logError
function to an arrow function it has lost it's correct reference to thethis
operator, which causes it to break.Instead of being a reference to the stream the
this
operator in this setup is a reference togulpSass
.Versions
Gulp Task
Error Message
Idea for solution
Change the
logError
function declaration from:To:
That way the
logError
gets its ownthis
operator, which in this case is the desired stream and thereby thethis.emit('end');
function will work again.I'll happily create a PR for this fix if you wish.
The text was updated successfully, but these errors were encountered: