less / less/less.js

Less file not listed in sources sourcemap array if it contains only variables

Open
#2,981 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request low priority
Dominant language
JavaScript
Stars
17k
Forks
3.4k
Avg merge
7h 42m
Merged PRs (30d)
26

Description

If I import a less file that only includes variables then it does not get included in sources. Here's an example, notice that the map file at the end does not include variables.less as a source.

main.less

@import "variables.less";

a { color: @theme-primary; }

variables.less

@theme-primary: #2C3E50;

main.css.map

{
  "version":3,
  "sources":["/less/main.less"],
  "names":[],
  "mappings":"AAGA;EACC,…"
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example using main.less, variables.less, and main.css.map, then trace the sourcemap generation for imports containing only variables. Confirm the fix by adding or updating a regression test so variables.less appears in the map's sources array without changing the generated CSS.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.