-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong line-numbers on source-map selectors - chrome reports position of first element, not last element #1492
Comments
I think this is because less actually marks up different parts of the selectors coming from different places.. so it tells chrome the first part of the selector comes from line 3 and the second part from line 9. When less uses However given the information in chrome is very sketchy anyway, we should probably only show information from the last part of the selector. |
this bug is now in the chromium bugs: https://code.google.com/p/chromium/issues/detail?id=287382 note to self: could be solved by overriding the fileinfo before each path is output. also need to think about extends where the middle selector is replaced - the path is created because of the extend so the extend is the important thing. marking this low as now as you can always scroll down.. it at least gives you a pointer.. unless @dotnetwise you have a reason why this is causing a big problem. |
note: work-around from #1715 is to control and click on the property not the selector. |
I have tested the example code from: http://stackoverflow.com/questions/27983598/css-source-maps-doesnt-report-the-correct-line-when-using-nested-selectors #main {
max-width: 500px;
color: white;
.sub-container {
color: blue;
}
} I found that the problem not only happens in chrome but also in firefox. Then i tried to compile the code with gulp-less and gulp-sourcemap (where i expect that gulp-sourcemap uses a different sourcemap generator ). The gulp build did not solve the problem too. On the other hand Less has the correct line numbers at some point (with --line-numbers=comments): /* line 1, /t.less */
#main {
max-width: 500px;
color: white;
}
/* line 4, /t.less */
#main .sub-container {
color: blue;
} |
Yes, but only for not "nested rules" If you nest anything in a big rule, then all the sourcemap lines will point to its top. |
* sourceMap pointing to wrong file at times * don't know if this is issue with grunt-contrib-less, or the config * related links: less/less.js#1492, gruntjs/grunt-contrib-less#243 (comment) * possible: nested selector, import; or configuration is not right. But it works for some css rules, breaks for others. Weird.
I've had a look at this with a simple less file: .top {
color: red;
.first {
color: blue;
}
& .second {
color: green
}
} which produces this css file .top {
color: red;
}
.top .first {
color: blue;
}
.top .second {
color: green;
} and the sourcemaps: {
"version": 3,
"sources": [
"style.less"
],
"names": [],
"mappings": "AAAA;EACE,UAAA;;AADF,IAGE;EACE,WAAA;;AAGF,IAAE;EACA,YAAA"
} Looking into it the problem is that line 4 and line 7 in the css file are slightly different:
In line 4 of the css ( So by using the |
The following less would point into the line of
html>body form
although the definition was explicitly forinput
.However, this would work correctly when using the
&
operator, but it is a pain to change all of the less definitions like thatI think this can be extent to other operators supported in less, but never the less, either empty or any operators should be supported correctly by the source maps, since it is valid less code.
The text was updated successfully, but these errors were encountered: