0

This is with regards to lessc I have three files:-

  1. less0.less (empty)
    (empty)
  1. less1.less
    @import "less0.less"
  1. 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:- Wrong Less File being Pointed

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 what would I have to change to get it right. Thanks in advance.

USE CASE: Say I have a file with less variables that has my UI Variables(Color,size,etc)(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.

CodeWar
  • 1
  • 3

1 Answers1

0

i think you should use import syntax of less not css like this

@import "less1";
hossein sedighian
  • 1,711
  • 1
  • 13
  • 16
  • my bad! I had originally used Double Quotes. Forgot to put in here! – CodeWar Nov 19 '20 at 11:32
  • you also used .trail class but it is not defined – hossein sedighian Nov 19 '20 at 12:28
  • I am declaring a variable(@var-test in less2.less) with value ".trial" which is being used further in the same file. the .trial class is being declared in less which would be processed to less2.css file and then this "less2.css" would be used for styling. :) – CodeWar Nov 19 '20 at 12:32