just-boris / less-plugin-glob

Globbing support for LESS
MIT License
70 stars 12 forks source link

Improved debugging #1

Closed Meesayen closed 9 years ago

Meesayen commented 9 years ago

The initial implementation of this plugin can leave the user wondering where exactly the issue is located, when he is presented with an error output like this:

Message:
    Unrecognised input in file common/styles/**/*.less line no. 825
Details:
    type: Parse
    filename: common/styles/**/*.less
    index: 13879
    line: 825
    callLine: NaN
    callExtract: undefined
    column: 13
    extract:     width: 100%;,    margin: 0:,  }
    lineNumber: 825
    fileName: common/styles/**/*.less

This PR fix this by keeping the reference of each processed file, by simply replacing the glob import with a list of imports, one for each file that matched the glob pattern. The error output would be something like this:

Message:
    Unrecognised input in file /Users/username/workspace/project/src/common/styles/a-style-file.less line no. 17
Details:
    type: Parse
    filename: /Users/username/workspace/project/src/common/styles/a-style-file.less
    index: 236
    line: 17
    callLine: NaN
    callExtract: undefined
    column: 13
    extract:     width: 100%;,    margin: 0:,  }
    lineNumber: 17
    fileName: /Users/username/workspace/project/src/common/styles/a-style-file.less

(the error output in the example above is produced by the gulp-less plugin for gulp, going through the gulp-plumber)

just-boris commented 9 years ago

Briliant! It's a better solution than I have.

But why you removed some arguments from methods? They already still there when less calling us, and if you omit it, it easy to forget about it.

Meesayen commented 9 years ago

@just-boris I just removed them for JSHint pleasure, it always complain about variables that are defined but never used. I suggest to keep them out and document the input parameters in a comment.

just-boris commented 9 years ago

Ok. I will do it and add JSHint validation into build.

just-boris commented 9 years ago

Merged. Thanks!