Gulp without generating css output

I struggled with this for several hours. My gulpfile has the following:

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 ends without errors, but .css is never created. I tried just to comment on the middle line, as shown below, and this works as expected; the fewer files are 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 css? If I use less, the file is generated correctly.

+5
source share
1 answer

I experienced this because of the undefined class in my smaller file.

I discovered the undefined class through logging.

Gulp may not cause errors unless you explicitly register them. To write, gulp-util is required in your gulpfile:

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

Then add the entry:

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

Run gulp style to see the error (perhaps the class is undefined).

Fix it and your style task should generate css.

+8
source

Source: https://habr.com/ru/post/1208453/


All Articles