less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17k stars 3.41k forks source link

Exclude function from imported file if its arguments are overridden by the importing file #3667

Closed rgroothuijsen closed 2 years ago

rgroothuijsen commented 2 years ago

This addresses issue #3563 by excluding functions in an imported file whose variable arguments are overridden by the file that is importing it. For every argument in the function, 3 things are checked:

  1. Is there a difference between filename and rootFilename for this file, i.e. is this a file that is being imported by another file?
  2. Does the root file contain a redefinition of the variable?
  3. Is this a variable argument?

If all 3 of these conditions are met for any of the arguments, the function is excluded from the final output, and any variables using this function to obtain a value remain undefined. Since silently ignoring these functions might lead to unexpected behaviors, perhaps Less could signal to the user in some way that it's doing this?