Skip to content

Commit

Permalink
Merge pull request CSSLint#457 from scottgonzalez/jsonrc
Browse files Browse the repository at this point in the history
Support JSON for .csslintrc files.
  • Loading branch information
stubbornella committed Feb 27, 2014
2 parents a0bce62 + f0b4097 commit f2abc8b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/cli/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,20 @@ function cli(api){
}

function readConfigFile(options) {
var data = api.readFile(api.getFullPath(".csslintrc"));
var data = api.readFile(api.getFullPath(".csslintrc")),
json;
if (data) {
if (data.charAt(0) === "{") {
try {
json = JSON.parse(data);
data = "";
for (var optionName in json) {
if (json.hasOwnProperty(optionName)) {
data += "--" + optionName + "=" + json[optionName].join();
}
}
} catch(e) {}
}
options = processArguments(data.split(/[\s\n\r]+/m), options);
}

Expand Down

0 comments on commit f2abc8b

Please sign in to comment.