less / less/less.js

Support sourcemap data pass-through for imported CSS files

Open
#2,801 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I have tried many differents options to import a css file with sourcemaps reference included into my less file but I always loose the sourcemaps.

Less is correctly generating the sourcemaps from css file to less compiled file.

My case :
I am generating somme css files with less (let's call it fileA.less [importing fileA1.less, fileA2.less] which compile to fileA.css and fileA.cass.map)
In another less file in another project I am importing fileA in my fileB :

/*fileB.less content*/
@import "/path/to/my/fileA.css"

fileB.less compile to fileB.css and fileB.css.map but this map only reference fileA.css not the fileA1 and fileA2 import.

I have tried diffrent imports styles but I only get correct sourcemaps when recompiling fileA i.e. importing fileA.less in fileB.less

It would be really helfull if this information wasn't lost..

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

Start by tracing how Less handles an imported CSS file and how it emits the resulting source map. Verify the behavior with a case where fileA.css references fileA1.less and fileA2.less, then consider the work complete when fileB.css.map preserves those original sources instead of only referencing fileA.css.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.