Skip to content

Commit

Permalink
skip jshint processing using a sourcePath object with src and jshint …
Browse files Browse the repository at this point in the history
…attributes
  • Loading branch information
Tauren Mills committed Aug 11, 2011
1 parent 4b19957 commit 12a3ef0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/smoosh/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,17 @@ var _config = {

getSourcePath: function (name, who) {
var extension = who == 'JAVASCRIPT' ? 'js' : 'css';
name = typeof name == 'string' ? name : name.src;
if (!new RegExp('\.' + extension + '$').exec(name)) {
name += '.' + extension;
}
if (name.charAt(0) === '!') {
name = name.substr(1);
}
return [this.STATIC_DIR[who], name].filter(clean).join('/');
},

getSkip: function (name) {
return typeof name == 'string' ? false : !name.jshint;
},

process: function (who) {
var that = this;
for (var key in this.config[who]) {
Expand All @@ -215,7 +217,8 @@ var _config = {

if (who == 'JAVASCRIPT'){
_files[[who, 'RAW'].join('_')][key] = this.config[who][key].map(function (PATH) {
return { skip: PATH.charAt(0) === '!', path: PATH, fileContent: fs.readFileSync(that.getSourcePath(PATH, who), 'UTF-8') };
var srcPath = that.getSourcePath(PATH,who);
return { skip: that.getSkip(PATH), path: srcPath, fileContent: fs.readFileSync(srcPath, 'UTF-8') };
});
}

Expand Down

0 comments on commit 12a3ef0

Please sign in to comment.