Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

nested styles refer to top-level parent in sourcemap line number #1206

Closed

Description

@opeologist

i'm having an issue where my nested styles' sourcemap line number in chrome is referencing the top-most parent selector line and not the line that the nested selector starts.

body {
  h1 {
    background: #f00;
  }
}

will show file.scss:1 instead of file.scss:2 for the h1

i've tried outputting the map file to a separate file and embedding it, all the same.

using 3.4.0-beta1

Activity

  1. xzyfer commented on Oct 17, 2015

    @xzyfer
    Contributor

    Hi @tehOPEologist, thanks for this issue. @mgreter any thoughts on this one?

  2. mgreter commented on Oct 17, 2015

    @mgreter
    Contributor

    Looks ok to me ...

  3. opeologist commented on Oct 17, 2015

    @opeologist
    Author
  4. mgreter commented on Oct 17, 2015

    @mgreter
    Contributor

    Why is Body on line 5 in your screenshot??

  5. opeologist commented on Oct 17, 2015

    @opeologist
    Author

    i just added some sample code in an already existing file. the devtools image shows core.scss:5, the parent of the h1, instead of 6, where the h1 selector starts.

  6. opeologist commented on Oct 20, 2015

    @opeologist
    Author

    @mgreter am i not understanding how the sourcemapping is supposed to work? if it's working as intended, then ok, but i had someone online say their node-sass was showing the nested line number instead of the nested selector's parent line number =/

  7. opeologist commented on Oct 23, 2015

    @opeologist
    Author

    @xzyfer any update?

  8. xzyfer commented on Oct 24, 2015

    @xzyfer
    Contributor

    Not really looking into this at the moment. Have you tried te beta?
    On 24 Oct 2015 5:30 am, "Aaron Giordano-Barry" [email protected]
    wrote:

    @xzfer any update?

    —
    Reply to this email directly or view it on GitHub
    #1206 (comment).

  9. opeologist commented on Oct 24, 2015

    @opeologist
    Author

    didn't see there was a new beta. i'll try that and report back. thanks!

  10. opeologist commented on Oct 24, 2015

    @opeologist
    Author

    looks like latest node-sass beta is doing the same thing as before. @mgreter i was under the impression that the sourcemapping would show the line of the actual selector, not its topmost parent. is showing the line number for the topmost parent of the tag the intended result? like i said when i first opened this issue, i've seen nested style with sourcemapping show the line of the actual selector, not its topmost parent..

  11. opeologist commented on Oct 30, 2015

    @opeologist
    Author

    just ran a test with the latest ruby sass and it's sourcemapping nested children on the child's line and not the top-most parent like it should be. this is definitely a bug and isn't working as intended.

    Ruby Sass 3.4.19:

    body {
      h1 {
        background: red;
      }
    }

    compiles to:

    body h1 {
      background: red; }
    
    /*# sourceMappingURL=core.css.map */

    core.css.map:

    {
    "version": 3,
    "mappings": "AACE,OAAG;EACD,UAAU,EAAE,GAAG",
    "sources": ["core.scss"],
    "names": [],
    "file": "core.css"
    }

    node-sass 3.4.1:

    body {
      h1 {
        background: red;
      }
    }

    compiles to:

    body h1 {
      background: red; }
    
    /*# sourceMappingURL=core.css.map */

    core.css.map:

    {
        "version": 3,
        "file": "core.css",
        "sources": [
            "core.scss"
        ],
        "mappings": "AAAA,IAAI,CACF,EAAE,CAAC;EACD,UAAU,EAAE,GAAI,GACjB",
        "names": []
    }
  12. opeologist commented on Oct 31, 2015

    @opeologist
    Author

    @mgreter do you see what i mean now with those examples?

  13. opeologist commented on Nov 4, 2015

    @opeologist
    Author

    @xzyfer any thoughts? trying to figure out if this is a libsass issue and i should open an issue on their repo or if this is node-sass specific... definitely an issue that needs addressing!

  14. 17 remaining items

  15. xzyfer commented on Nov 28, 2015

    @xzyfer
    Contributor

    This has been fixed in LibSass. I'll close this issue when we do a new release with the update LibSass version.

  16. opeologist commented on Nov 28, 2015

    @opeologist
    Author

    thank you so much all! i'll be patiently waiting for the new node-sass release! :D

  17. HugoHeneault commented on Dec 2, 2015

    @HugoHeneault

    Awesome! Can't wait for it!!

  18. ericwooley commented on Dec 14, 2015

    @ericwooley

    Any updates on this?

  19. tomlagier commented on Jan 25, 2016

    @tomlagier

    Any updates on this?

  20. opeologist commented on Jan 29, 2016

    @opeologist
    Author

    just tested on node-sass v3.5.0-beta.1 and confirm sourcemap line numbers are referring to correct selector! thank you SO MUCH @mgreter !!!!! i'll leave this to be closed by you once the version goes out of beta.

  21. mgreter commented on Jan 30, 2016

    @mgreter
    Contributor

    Even though it is technically wrong what I did to achieve this (since browsers interpret it not carefully enough IMO), you're welcome 😄

  22. opeologist commented on Jan 30, 2016

    @opeologist
    Author

    xD thanks again man!

  23. am11 commented on Jan 30, 2016

    @am11
    Contributor

    Was this problem occurring only on Chrome or every browser tools with source-map support? Last time I checked (few months ago, while giving a presentation), my sample worked on Chrome, Edge (MSDN) and Firefox (Mozilla hacks). If there is a disparity between what libsass was generating previously and how Chrome is interpreting it, with this fix, it might have broken other browsers. :/
    LibSass emits detailed mappings, which many trans-compilers (of JS and CSS) lack including RubySass. @mgreter has nailed this feature! 👍

    @mgreter, note that what I used in WebEssentials2013 for VS-IDE preview window was based on https://github.com/mozilla/source-map (which is probably used in Firefox tools implementation as well), so it might interpret the line numbers differently. Last I remember, line and col number were off by one (line was 0-based and col was 1-based or vice versa), viz the typical:

    there are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.

    Thank you so very much nonetheless. 😎

  24. modified the milestone: next.libsass on Sep 4, 2016
  25. ggedde commented on Sep 10, 2017

    @ggedde

    I am still having this issue on FIrefox.
    There is another open issue for this that might clarify why this is happening: #2092

  26. SweetsXob commented on Jul 10, 2019

    @SweetsXob

    This problem does not seem to be solved now.
    It seems less doesn't have this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions