gulp-community / gulp-less

A LESS plugin for Gulp
559 stars 116 forks source link

How do you pass the rootpath option ? #282

Closed gmisa closed 6 years ago

gmisa commented 6 years ago

Hi, i'm trying to set rootpath from my gulp task but it doesn't seem to be working. Am I doing anything wrong? I am using gulp-less v3.3.0

Thanks

gulp.task('less', [], function () {
    var env = process.argv[2];
    var imagePath = '';
    switch(env) {
        case 'localhost':
            imagePath = 'https://localhost/assets/';
            break;
        case 'development':
        case 'production':
            imagePath = 'https://production/assets/';
            break;
    }

    return gulp.src(config.less.src)
      .pipe(less({
          paths: config.lessPath,
          rootpath: imagePath
      }))
      .pipe(gulp.dest(config.less.dest));
});
stephenlacy commented 6 years ago

Did you confirm the output is correct using the lessc CLI?

gmisa commented 6 years ago

Sorry my bad. It actually works. I changed the url('/file') to url('file') in the less file