radist2s / gulp-less-sourcemap

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

Invalid mapping and undefined file with latest version of less #5

Closed ChromeQ closed 8 years ago

ChromeQ commented 8 years ago

Less recently updated to v2.7.0 and has caused a break in this module. v2.6.1 works fine and it is my temporary fix on my project but ideally it would be nice to fix the underlying problem and support the latest version.

[13:14:52] Plumber found unhandled error:
 Error in plugin 'gulp-less-sourcemap'
Message:
    Invalid mapping: {"generated":{"line":1038,"column":2},"source":".//var/www/html/quantum/resources/assets/less/bootstrap/grid.less","original":{"line":1,"column":null},"name":null} in file undefined line no. undefined
Details:
    lineNumber: undefined
    fileName: undefined
radist2s commented 8 years ago

I tried to reproduce the problem, but compilation goes fine. Could you provide more information or show me the case to reproduce bug?

ChromeQ commented 8 years ago

Sure, here is my gulp task:

gulp.task('less', ['clean:css'], function () {
    return gulp.src(paths.lessviews)
        .pipe(plumber())
        .pipe(less({
            sourceMap: {
                sourceMapURL: 'quantum.css.map',
                sourceMapRootpath: '../resources/assets/less',
                sourceMapFileInline: false
            }
        }))
        .pipe(gulp.dest('public/css'))
        .pipe(livereload());
});

The task often silently fails so I had to use the gulp-plumber if that helps? One of the files selected by the paths.lessviews is called app.less, and the first line of that file contains @import "bootstrap/bootstrap.less"; Here is the folder structure:

quantum/
    -resources/
        -assets/
            -less/
                -bootstrap/
                    bootstrap.less
                    grid.less
                    ...
                -views/
                    home.less
                app.less
    gulpfile.js

Let me know if you need anything else specifically, I hope this is enough info. There were quite a few changes to the less project in v2.7.0 and I saw somewhere in stackoverflow (sorry can't find the link now) mentioning the comments blocks in less

radist2s commented 8 years ago

@ChromeQ, it was problem in less 2.7.0 release. In 2.7.1 the bug with sourcemaps was fixed.