Skip to content
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

not working with gulp 4.0 #383

Closed
TeodorKolev opened this issue Oct 31, 2015 · 22 comments
Closed

not working with gulp 4.0 #383

TeodorKolev opened this issue Oct 31, 2015 · 22 comments

Comments

@TeodorKolev
Copy link

Task did not finish Starting gulpSass...

var gulp = require('gulp');
var sass = require('gulp-sass');

var paths = {
  sass:    'src/css/**/*.scss',
 };
gulp.task('sass', function () {
  return sass(paths.sass)
    .on('error', sass.logError)
    .pipe(gulp.dest('src/css'));
});
function watch() {
  livereload.listen();
  ...
  gulp.watch(paths.sass, sass);
}

gulp.task('build',  gulp.parallel(sass, ... watch));

gulp.task('default', gulp.series('build'));
@Keats
Copy link
Collaborator

Keats commented Oct 31, 2015

You need to use gulp.src, here's the task I've been using with gulp 4 for months now

var sassFiles = "src/style/**/*.scss"

gulp.task("sass", function() {
  return gulp.src(sassFiles)
    .pipe(sass({outputStyle: "compressed"}).on("error", sass.logError))
    .pipe(autoprefixer())
    .pipe(gulp.dest(outputFolder))
});

@Keats Keats closed this as completed Oct 31, 2015
@TeodorKolev
Copy link
Author

That makes absolute no difference. Just tested, btw 10x for the quick response. Task is starting and thats it. When I change sass file it start again and never finish. Gulp is version 4. Please test and if you find why tasks not finish share here. Thanks

@TeodorKolev
Copy link
Author

Plsease test and don't close issues like that

'use strict';

var gulp = require('gulp');
var sass = require('gulp-sass');

gulp.task('sass', function () {
  gulp.src('src/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('dist/css'));
});

gulp.task('sass:watch', function () {
  gulp.watch('src/**/*.scss', ['sass']);
});


gulp.task('build', gulp.series(
  gulp.parallel(sass)
));

gulp.task('default', gulp.series('build'));

@Keats
Copy link
Collaborator

Keats commented Oct 31, 2015

The above works for me (minus the gulp 4 incompatibility: gulp.watch('src/*/.scss', ['sass']); ).

I've tried on one of my repo (https://github.com/Keats/snowflake) and I don't get any error and everything finishes correctly. Let me know if my repo works for you and otherwise please provide a sample repo that reproduces the error

@Keats Keats reopened this Oct 31, 2015
@ghost
Copy link

ghost commented Nov 2, 2015

@Keats been using this with gulp 4 and it works fine. This is an issue with his tasks.

@TeodorKolev

this is wrong

gulp.task('build', gulp.series(
  gulp.parallel(sass)
));

should be

gulp.task('build', gulp.series('build, 'watch:sass'));

and

gulp.task('sass', function () {
  gulp.src('src/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('dist/css'));
});

should be

gulp.task('sass', function (done) {
  return gulp.src('src/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('dist/css'));
});

You need to have return and done for tasks that do not run async.

@Keats You can close this, this is an issue with his gulp tasks.

@Zork33
Copy link

Zork33 commented Nov 13, 2015

I’ve being using gulp-sass since Apr 2015, and it perfectly worked with up to NodeJS 0.2.12 Once I’ve switched to NodeJS 4.2.2 – I’ve faced with very close problem. Gulp-sass task starts and then nodejs stop working.

To be clear, I've made a test based on a code from this thread. It’s CoffeeScript:

gulp = require 'gulp'
sass = require 'gulp-sass'

sassFiles = './src/sass/**/*.sass'

gulp.task 'default', (->
  return gulp.src(sassFiles)
  .pipe(sass(outputStyle: "compressed").on("error", sass.logError))
  .pipe(gulp.dest('./build')))

and this what I see in console:

C:\Work\TestProj>gulp
[21:21:38] Using gulpfile C:\Work\TestProj\gulpfile.js
[21:21:38] Starting 'default'...
C:\Work\TestProj>

I'm working on Window7 x64. Could that be a problem?

Any idea how I could get more details from nodejs why gulp-sass kills it?

@Zork33
Copy link

Zork33 commented Nov 14, 2015

I’ve found specific reason why my nodejs 4.2.2 was crashing with my sass files. It was the fact that I was calling Susy @include container prior of calling @include layout. And now gulp-sass perfectly works for me on NodeJS 4.2.2. So, my issue is closed

In general, it’s still interesting why sass code can silently crash nodejs. I believe this question is for node-sass project.

@xzyfer
Copy link
Collaborator

xzyfer commented Nov 14, 2015

Could you please create a sample sass file I can test with. We should fix
this crash in LibSass.
On 13 Nov 2015 11:39 pm, "Alexey Zorkaltsev" notifications@github.com
wrote:

I’ve found specific reason why my nodejs 4.2.2 was crashing with my sass
files. It was the fact that I was calling Susy @include
https://github.com/include container prior of calling @include
https://github.com/include layout. And now gulp-sass perfectly works
for me on NodeJS 4.2.2. So, my issue is closed

In general, it’s still interesting why sass code can silently crash
nodejs. I believe this question is for node-sass project.


Reply to this email directly or view it on GitHub
#383 (comment)
.

@Zork33
Copy link

Zork33 commented Nov 15, 2015

https://github.com/Zork33/libsass-bug - simple project that demonstrates the problem

@JimBobSquarePants
Copy link

@xzyfer

Using concatenation rather than interpolation can cause it to crash out also.

Bad

background: url($img-url + "/icons/icon-play.png") 0 0 no-repeat;

Good

background: url("#{$img-url}/icons/icon-play.png") 0 0 no-repeat;

@xzyfer
Copy link
Collaborator

xzyfer commented Nov 19, 2015

@JimBobSquarePants good news this appears to be fixed. Try the latest node-sass.

@xzyfer
Copy link
Collaborator

xzyfer commented Nov 19, 2015

@Zork33 I can confirm this does segfault. Unable to create a reduced test cases of yet.

@xzyfer
Copy link
Collaborator

xzyfer commented Nov 19, 2015

@Zork33 OK I have a minimal reproduction now. Thanks heaps for creating that repo!

@mixin foo($bar...) {
  @each $item in $bar {
  }
}

@include foo(());

I believe this a duplicate of sass/libsass#1709

@JimBobSquarePants
Copy link

Thanks @xzyfer . Great to hear!

@loganhenson
Copy link

@TeodorKolev I wanted to post the actual issue (in case you hadn't resolved it)..

You are actually calling gulp-sass (the npm module, which is not a gulp task) directly, instead of the sass task. Try naming you sass task something different and it will complete properly. Hope that helps anyone who made the same mistake and ends up here!

@fyddaben
Copy link

i have the same question .start sass .and never finished

@fyddaben
Copy link

i update my node-sass to 3.2.5 . and slove it . It waste one night time......

@glen-84
Copy link

glen-84 commented Dec 11, 2015

Why is this issue still open?

@glen-84
Copy link

glen-84 commented Dec 11, 2015

Actually, the code in the README needs to be updated, as it doesn't return the stream.

@xzyfer
Copy link
Collaborator

xzyfer commented Dec 11, 2015

We're open to pull requests.
On 11 Dec 2015 9:05 pm, "Glen" notifications@github.com wrote:

Actually, the code in the README needs to be updated, as it doesn't return
the stream.


Reply to this email directly or view it on GitHub
#383 (comment)
.

@Keats
Copy link
Collaborator

Keats commented Dec 11, 2015

#408 should solve that

@glen-84
Copy link

glen-84 commented Dec 11, 2015

Ah, I forgot about your PR. So this can be closed then?

@Keats Keats closed this as completed Dec 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants