Skip to content

Wrong line number in imported less files. #1715

Closed

Description

@leedorian

Can't locate the rules' line number in imported less files, always 1 in chrome's styles panel.

Activity

  1. Soviut commented on Dec 5, 2013

    @Soviut

    Please provide more information. Are you using less.js, are you dealing with a compiled source map, etc.

  2. leedorian commented on Dec 5, 2013

    @leedorian
    Author

    I'm using grunt-contrib-less to compile my less;

    This is my main.less

    @import "reset.less";
    @import "universe.less";
    @import "homepage.less";
    @import "login.less";
    
    and when I inspect any rules in homepage.less, the line number in chrome styles panel always one: "homepage.less:1"
    
    This is my homepage.less
    #homepage{
        .cms{
            .border1pxgray;
            img{
                display:block;
            }
        }
        .sidebar{
            width:190px;
            float:left;
            h2{
                line-height:50px;
                background:@color_impact1;
                padding-left:10px;
                font-size:16px;
                margin:0;
            }
            .lhsnav{
                margin:0 auto;
                padding:0 5px 0 8px;
                border-bottom:4px solid @color_impact1;
                li{                
                    background:url(../images/arrow_right_1.png) no-repeat right;
                    padding:0 4px 0 0;
                    a{
                        border-bottom:1px solid @color_impact1;
                        padding:9px 15px 8px 3px;
                        display:block;
                        line-height:18px;
                    }
                }
                li:last-child a {
                    border-bottom:0;
                }
            }
            .cms{
                margin-top:20px;
            }
        }
        .content{
            width:550px;
            float:left;
            margin-left:10px;
            .homecenter_paragraph{
                padding:5px 0 19px;
                h4{
                    font-size:18px;
                    font-weight:normal;
                    margin-bottom:18px;
                }
                p {
                    margin-bottom:16px;
                }
            }
        }
        .sidebar_right{
            width:190px;
            float:right;
            .nextdaydelivery{
                img{
                    display:block;
                }
            }
            .cms{
                margin-top:20px;
            }
            .quickorder{
                .border1pxgray;
                border-bottom:0;
                margin-top:20px;
                background:@color_impact1;
                h2{
                    line-height:48px;
                    background:#fff;
                    padding-left:10px;
                    font-size:16px;
                    margin:0;
                }
                form{
                    margin:0;
                }
                table{
                    margin:16px 10px 0 9px;
                }
                th{
                    padding:0 0 12px 1px;
                    font-weight:normal;
                    text-align:left;
                }
                td{
                    padding-bottom:10px;
                }
                .skuinput {
                    padding-right:20px;
                    input{
                        width:86px;
                    }
                }
                .qtyinput{
                     input{
                        width:33px;
                    }
                }
                .unibtn-primary{
                    width:168px;
                    margin:1px 0 0 10px;
                    display:block;
                    font-size:16px;
                    font-family:Arial,sans-serif;
                }
                .exceltemplate{
                    text-align:center;
                    padding:14px 10px 17px;
                    a{
                        text-decoration:underline;
                    }
    
                }
                .orderfromcata{
                    h3{
                        font-size:14px;
                        padding:0 0 0 10px;
                        margin:0;
                        color:#fff;
                        height:40px;
                        line-height:40px;
                        background:#6d6e72 url(../images/arrow_down_3.png) no-repeat 168px 14px;
                        cursor:pointer;
                    }
                    .inner{
                        padding-bottom:20px;
                    }
                }
            }
            .freesample{
                padding:3px;
            }
        }
    
    }
  3. Soviut commented on Dec 5, 2013

    @Soviut

    REFORMAT YOUR CODE! Click the "pencil" icon and wrap all your code in triple back ticks.

    I understand your concern, but please don't walk into the banquet hall and immediately fart on everybody's plate. There's a "Github Flavoured Markdown" link right above the editor, with a "preview" tab as well. Use that!

    Take a few moments to understand your community before posting. Here, Stack Overflow, etc.

  4. Synchro commented on Dec 5, 2013

    @Synchro
    Member

    Where's a like button when you need one? I fixed the markup...

  5. leedorian commented on Dec 6, 2013

    @leedorian
    Author

    Sorry for the messy code, this is my first time use code block in comment.

  6. seven-phases-max commented on Dec 6, 2013

    @seven-phases-max
    Member

    @leedorian, most likely the problem is not in your less code itself but in some configuration/enviroment stuff used. For instance, it could be one of "sourcemap" options used (or not used) for the compilation and/or chrome version/settings. Take a look at #1050, you'll find a couple of "usage tips" closer to its end.

  7. leedorian commented on Dec 9, 2013

    @leedorian
    Author

    @seven-phases-max , I found a repository that use lessc to generate source map for bootstrap, it also got the line number isuue. umaar/bootstrap-source-map-example#1

  8. lukeapage commented on Dec 9, 2013

    @lukeapage
    Member

    Yes, its possible there is a bug in the sourcemap code, I will need to
    investigate. Also possible its chrome, the sourcemaps less generate can end
    up much more complex and strange than say a JavaScript minifier.

  9. matthew-dean commented on Dec 20, 2013

    @matthew-dean
    Member

    @Soviut Settle down, buddy, lol.

  10. lukeapage commented on Feb 23, 2014

    @lukeapage
    Member

    @leedorian thats because the whole file is wrapped in a single selector. Hold down control and click on the property that you are interested in - it will take you to the correct property. The problem is that less tells chrome

    #homepage- begins line 1
    .sidebar - begins line 8
    ul - begins line 11

    and chrme only looks at the first line.

  11. lukeapage commented on Feb 23, 2014

    @lukeapage
    Member

    duplicate of #1492

  12. leedorian commented on Mar 11, 2014

    @leedorian
    Author

    Thanks, lukeapage, you are right.

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