gulp-less icon indicating copy to clipboard operation
gulp-less copied to clipboard

Incorrect source line reported when injecting source maps

Open mrt123 opened this issue 7 years ago • 2 comments

Source line points to root parent rule in the .less file instead to the nested rule. Unless its ':before' rule, in this case it points to actual line where rule is defined.

Example navbar.less:

@import  (reference)  "../common/common";

.ch-nav-bar {
  .leftMenu {
    i.logo {
      .chIcon();
      position: relative;
      top: 4px;
      font-size: 24px;
      margin: 7px 20px 7px 25px;
      &:before {
        content: "\f015";
      }
      &:hover {
        cursor: pointer;
      }
    }

    a {
      margin: 7px 20px;
      padding: 7px 0;
    }

  }
}

For element i:before, sourcemap indicates source line navbar.less:11 (correct behaviour) For element i.logo sourcemap indicates source line navbar.less:3 (expected is 5) In fact any other element underneath ch-nav-bar is reported to have rule defined on line navbar.less:3

Gulp task:

gulp.task('compile-app.css', function () {

    return gulp.src(project.LESS_FILES)
        .pipe(sourceMaps.init())
        .pipe(less())   // compatible plugin used : 'gulp-less'
        .pipe(sourceMaps.write())
        .pipe(gulp.dest(BUILD_PATH));
});

mrt123 avatar Jul 28 '16 16:07 mrt123

@mrt123 Did you find a solution for this issue?

ghost avatar Jan 09 '19 18:01 ghost

Can you check if this is still an issue on the new v5?

yocontra avatar Jun 16 '21 18:06 yocontra