0

Input:

gulp.js

var gulp = require('gulp');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');

gulp.task('less', function() {
    return gulp.src('src/less/style.less')
        .pipe(sourcemaps.init())
        .pipe(less())
        .pipe(sourcemaps.write('.'))

    .pipe(gulp.dest('dist/css'))

});

package.json

{
  "devDependencies": {
    "gulp": "~3",
    "gulp-less": "~1.1.10"
  },
  "dependencies": {
    "gulp-sourcemaps": "^2.6.4"
  }
}

src/less/style.less have a lot of imports only, any styles.

gulp less generated to map file and /*# sourceMappingURL=style.css.map */ in the end of the file exists, but I don't see and links to actual less files in Crome Dev Tools and the content of map file is not looks like on file content generated by Grunt:

{"version":3,"names":[],"mappings":"","sources":["style.less"],"sourcesContent":["// MaxA styles\r\n@import (reference) 'base/_mixins';\r\n@import (reference) 'base/_variables';\r\n@import \"layout/_base.less\";\r\n\r\n// Magento\r\n@import \"magento\";\r\n//font\r\n@import \"font\";\r\n// Reset\r\n@import \"normalize\";\r\n@import \"print\";\r\n// Core CSS\r\n@import \"scaffolding\";\r\n@import .............................

Any ideas?

Thanks.

seven-phases-max
  • 11,765
  • 1
  • 45
  • 57
Max.A
  • 71
  • 5
  • >`"gulp-less": "~1.1.10"` - hmm, looks like very ancient version (~2014), most likely Less just did not support any sourcemaps by then). – seven-phases-max Apr 03 '18 at 19:24
  • O, yes, my friend, you are absolutely right. I'm new on this project and trying to reorganize all this garbage. Gulp-less updated to 4.0.0, everything is working fine for now. Thanks. Fresh look is very important some times. – Max.A Apr 04 '18 at 04:58
  • Use latest `gulp-less 3.x` version. `4.0.0` is not stable yet (because of some bugs in `less 3.0.x` it ships with). – seven-phases-max Apr 04 '18 at 09:29
  • Thanks, I'll test on weekend. Absolutely terrible debugging in style of "loos like something happened". No any debugging if the watcher started. I tried several solution and found the other wonderful bug of watcher: remove right bracker - git the error, but working, no fault, add the right bracket again (undo), save ... got the same error again. Can be fixed with watcher only. That's some hell, not compiler. – Max.A Apr 05 '18 at 04:47

0 Answers0