gulp-less not creating output css
Asked Answered
C

1

6

I've been struggling with this for a few hours now. I have the following in my gulpfile:

gulp.task('styles', function() {
  gulp.src('C:\\TeamCity\\buildAgent\\work\\5003e8de5901599\\dev\\Content\\css\\less\\dealer-landing.less')
    .pipe(less())
    .pipe(gulp.dest('C:\\TeamCity\\buildAgent\\work\\5003e8de5901599\\dev\\Content\\css'));
});

I run 'gulp styles' which completes with no errors, but the .css is never created. I tried simply commenting out the middle line as seen below and that works as expected; the less file gets copied to the dest directory:

gulp.task('styles', function() {
  gulp.src('C:\\TeamCity\\buildAgent\\work\\5003e8de5901599\\dev\\Content\\css\\less\\dealer-landing.less')
    //.pipe(less())
    .pipe(gulp.dest('C:\\TeamCity\\buildAgent\\work\\5003e8de5901599\\dev\\Content\\css'));
});

Any idea why gulp-less doesn't generate the css? If I use just less, the file is generated correctly.

Conditioned answered 5/12, 2014 at 18:12 Comment(2)
have you defined var less = require('gulp-less');?Meli
Can you show more of your gulp file?Polynomial
C
10

I experienced this due to an undefined class in my less file.

I discovered the undefined class through logging.

Gulp may not throw errors unless you explicitly log them. To log, require gulp-util in your gulpfile:

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

And then add logging:

.pipe(less().on('error', util.log)),

Run gulp style to see the error (possibly an undefined class).

Fix it and your style task should generate the css.

Compartmentalize answered 28/12, 2014 at 2:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.