Less.js: LESS doesn’t create a map from closed bracket }

Created on 25 Jan 2015  ·  6Comments  ·  Source: less/less.js

Most helpful comment

This is still a problem in 2.7.1

All 6 comments

@bassjobsen I can't reproduce any problem, could you add more detail? I've tried a few examples from the linked bug but I think I need
a. test case (or x always happens in this case)
b. actual output
c. expected output

Hi Luke,
Firstly, i don't want to bother you with any unsolved or vague questions.

In short what i found:

my Less file, t.less:

p {
color: red; 
}

Then i run: lessc t.less t.css --source-map --autoprefix

t.css.map now contains:

{"version":3,"sources":["t.less","t.css"],"names":[],"mappings":"AAAA;EACA,YAAA;ECCC","file":"t.css"}

without the autoprefixer: lessc t.less t.css --source-map the sourcemap looks like that shown below:

{"version":3,"sources":["t.less"],"names":[],"mappings":"AAAA;EACA,UAAA","file":"t.css"}

As you can see after running the autoprefixer the output don't change, but the sourcemap does and adds
the output file as an source. As far as i do understand and can test, this also differs from the same code in SASS.
see: https://github.com/postcss/autoprefixer-core/issues/27#issuecomment-71343166

After all i think the right outcome of the above is possible ambiguous cause in the situation that the autoprefixer adds some rules what should be the source of these rules?

So again i don't want to waste your time. I'm not sure it is an issue indeed and i'm also not sure if it will hurt someone.

Ah yes, this is the issue i raised with a-p which they just closed. I will
look at the linked issue again and try if it can be fixed.

This is still a problem in 2.7.1

this is still a problem in 3.11.1. The source map has no mapping made for closing brackets. I zipped up the source less file, the source map that get generated and the output css file.

If it helps to see the bug yu can go here https://sokra.github.io/source-map-visualization/#custom and load the files in to visualization tool and see the bug for yourself.

The reason this is such a pain is when you are applying mulitple stages of transformations to a file

For example Less -> CSS -> Autoprefixed CSS -> concatenated CSS file
To make source maps that go from the last stage back to the first each map needs to be complete

less_bug.zip

Was this page helpful?
0 / 5 - 0 ratings