Dancer
Dancer

Reputation: 17681

Gulp - Less errors

I am pretty new to Gulp - I'm a new convert from Grunt.

I've setup my first Gulp file to preprocess

var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
var less = require('gulp-less');
var autoprefixer = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var notify = require('gulp-notify');
var gutil = require('gulp-util');
var parentPath = './app/';
var sourceLess = parentPath + 'less';
var targetCss = parentPath + 'css';
var path = require('path');

gulp.task('less', function () {
  return gulp.src('./app/less/styles.less')
    .pipe(less({
      paths: [ path.join(__dirname, 'less', 'includes') ]
    }))
    .pipe(gulp.dest('./app/css'));
});

gulp.task('minify-css', function() {
  return gulp.src('./app/css/styles.css')
    .pipe(cleanCSS({compatibility: 'ie8'}))
    .pipe(gulp.dest('dist'));
});

gulp.task('default', function () {
    gulp.watch('app/less/**/*.less', ['less']);   
    gulp.watch('app/css/styles.css', ['minify-css']);  
});

It seems to work fine bar two issues -

  1. I want the less to output into one CSS file called styles.css rather than multiple.
  2. I dont appear to get any error output if i create a bug in the less file - it compiles regardless

for example i have added this code into one of my less files:

enter image description here

but my gulp output is processed as normal:

enter image description here

Upvotes: 1

Views: 83

Answers (0)

Related Questions