radist2s / gulp-less-sourcemap

A LESS plugin for Gulp with sourcemap support
10 stars 5 forks source link

Gulp task fails to complete when using more than one LESS plugin. #3

Closed AlexanderOMara closed 8 years ago

AlexanderOMara commented 9 years ago

First of all, this plugin is awesome. There's just one fatal issue I'm having with it. When I try to pass more than 1 plugin to the LESS compiler, it silently fails in gulp-less-sourcemap, however gulp-less does not have this issue.

Here is a test case:

package.json

{
  "name": "gulpless",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "gulp": "^3.8.11",
    "gulp-less": "^3.0.2",
    "gulp-less-sourcemap": "^1.4.2",
    "less-plugin-autoprefix": "^1.4.1",
    "less-plugin-clean-css": "^1.5.0"
  }
}

less/test.less

.class {
    display: flex;
}

gulpfile.js

var gulp = require('gulp');
var gulpLess = require('gulp-less');
var gulpLessSourcemap = require('gulp-less-sourcemap');
var LessPluginAutoPrefix = require('less-plugin-autoprefix');
var LessPluginCleanCSS = require('less-plugin-clean-css');

gulp.task('less', function() {
    return gulp.src('./less/**/*.less')
        .pipe(gulpLess({
            plugins: [
                new LessPluginAutoPrefix({
                    browsers: ['> 0%'],
                    cascade: true
                }),
                new LessPluginCleanCSS({
                    advanced: true
                })
            ]
        }))
        .pipe(gulp.dest('./css/'));
});

gulp.task('lessmap', function() {
    return gulp.src('./less/**/*.less')
        .pipe(gulpLessSourcemap({
            plugins: [
                new LessPluginAutoPrefix({
                    browsers: ['> 0%'],
                    cascade: true
                }),
                new LessPluginCleanCSS({
                    advanced: true
                })
            ]
        }))
        .pipe(gulp.dest('./css/'));
});

When I run the less task, it completes successfully.

$ gulp less
[15:43:27] Using gulpfile ~/some/path/gulpless/gulpfile.js
[15:43:27] Starting 'less'...
[15:43:28] Finished 'less' after 103 ms
$

However, when I run the lessmap task, it fails silently, and never says "Finished".

$ gulp lessmap
[15:43:32] Using gulpfile ~/some/path/problems/gulpless/gulpfile.js
[15:43:32] Starting 'lessmap'...
$

If you comment out either plugin however, it will complete.

Since the error is silent, I'm not sure how to debug the issue. I'm really hoping this can be fixed, I much prefer the way this plugins generates source maps.

radist2s commented 9 years ago

Thank you for bug report. I will fix this bug, but later. I am too use autoprefixer, but in another way. May be it will be useful for you like temporary solution.

radist2s commented 8 years ago

I have to close this old issue because I can't reproduce the bug. In my case plugins work fine.