less.js icon indicating copy to clipboard operation
less.js copied to clipboard

LESS doesn’t create a map from closed bracket }

Open bassjobsen opened this issue 10 years ago • 6 comments

See: https://github.com/plus3network/gulp-less/issues/126

Related issues: https://github.com/plus3network/gulp-less/issues/126

bassjobsen avatar Jan 24 '15 23:01 bassjobsen

@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

lukeapage avatar Jan 27 '15 17:01 lukeapage

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.

bassjobsen avatar Jan 27 '15 23:01 bassjobsen

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.

lukeapage avatar Jan 28 '15 04:01 lukeapage

related: https://github.com/sindresorhus/gulp-autoprefixer/issues/10

boogerlad avatar Feb 01 '15 10:02 boogerlad

This is still a problem in 2.7.1

wolfy1339 avatar May 17 '16 01:05 wolfy1339

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

BrianMulhall avatar Mar 03 '20 04:03 BrianMulhall