I am using the LESS compiler via gulp -less in my gulpjs build. I turned on sourceMap generation and it seems to work, there are correct file names and line numbers.
The gulp line that generates LESS with source maps is very simple:
var less = require('gulp-less'); // [...] gulp.src('web/css/**/*.less') .pipe(less({ sourceMap: true })) .pipe(gulp.dest('dist/css'));
The only problem is that the source map contains the URL of the source .less file and is generated as an absolute path to my file system, for example. /Users/myuser/projects/project/web/css/myfile.less .
During development, I serve the site through Apache. When I open a site using Chrome DevTools, I can check the elements, and the source map works because I can see myfile.less , including the correct line numbers in the Styles panel. However, Chrome tries to download fewer files, and it uses the full path - this is the output of sourcemap, but provided that it is the relative URL for my site, so it tries to download http://localhost/Users/myuser/projects/project/web/css/myfile.less , which does not exist.
I tried using workspaces to fix this, but I really couldn’t do it. Is there something wrong with this setting? Did I miss something?
source share