Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Source-map files from lessc pointing to wrong less file #3567

Closed
Dvd1234 opened this issue Nov 12, 2020 · 1 comment · Fixed by #3761 · May be fixed by ITSecOps-404/aports#1
Closed

Source-map files from lessc pointing to wrong less file #3567

Dvd1234 opened this issue Nov 12, 2020 · 1 comment · Fixed by #3761 · May be fixed by ITSecOps-404/aports#1

Comments

@Dvd1234
Copy link

Dvd1234 commented Nov 12, 2020

Hey @seven-phases-max @matthew-dean @hirosato @Justineo and everyone in here. :)
This is with regards to lessc. Say, I have three files:-

  1. less0.less (empty)
    (empty)
  2. less1.less
    @import 'less0.less'
  3. less2.less
    @import 'less1.less'
    @var-test: .trial;
    
    @{var-test}{
          color: red;
    }

I am generating Source-map for these files by:-

lessc less2.less less2.css --source-map

The generated CSS files are being used in an html file. Source files are being used for debugging in browser. Now in browser, it shows the .trial class to be in less0.less and not less2.less So, Expected behavior is to have shown less2.less as source for .trial class and not the one being shown:-
https://i.stack.imgur.com/QiNQD.png

That's the less2.css.map file
{"version":3,"sources":["less0.less","less2.less"],"names":[],"mappings":"AAAA;ECKI,wBAAA","file":"less2.css"}

Could anyone please help me out if its an issue or if I need to tweak some setting. Thanks in advance.

USE CASE: Say I have a file with less variables that has my configurations(Say less1.less). I am importing those settings in some other file(Say less2.less). Then, after Source-mapping, when trying to check source from source in dev-tool, it takes me to less1.less and not less2.less.

@matthew-dean
Copy link
Member

Source maps don't have good test coverage / verification. Unfortunately, the source map is rather opaque once it's generated, so I don't know a good way to verify / test that code in X file should equal Y output in a .map file. If there are testing utilities, it would be a good first issue for someone to take on.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
2 participants