Skip to content

Commit

Permalink
refact
Browse files Browse the repository at this point in the history
  • Loading branch information
gemss committed Jan 15, 2014
1 parent 40ab394 commit 30d4618
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = function(grunt) {
// Src matches are relative to this path.
cwd: '<%= pkg.config.src_js %>',
// match all match files in the ${cwd}/ subdirectory and all of its subdirectories.
src: ['tinymce/**'],
src: ['api/ablesky.api.login.js', 'tinymce/**'],
// Destination path prefix.
dest: '<%= pkg.config.dest_js %>',
filter: 'isFile'
Expand Down
6 changes: 4 additions & 2 deletions lib/common/filemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ function sortDepends(deps, index) {
deps[i] = deps[interchangeIndex];
deps[interchangeIndex] = tmp;


sortDepends(deps, index);
break;
}
Expand Down Expand Up @@ -145,7 +144,10 @@ exports.addAmdDepends = function(identifier, deps) {
deps = deps.map(function(element) {
return (/\.js$/).test(element) ? element : element + '.js';
});
exports.get(identifier).dependencies = exports.get(identifier).dependencies.concat(deps);
exports.get(identifier).dependencies = exports.get(identifier).dependencies.concat(deps).filter(function (ele, index, array) {
// rm duplicated element in this array.
return array.indexOf(ele) === index;
});
}

return exports.get(identifier);
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/opti-jsp.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ module.exports = function(grunt) {
log.debug(2);
// jsp file is head-content.jsp || includeJS.jsp
sourceContent += filemapTmpl(gexcludes);
// add global deps, add them to filemap.
filemap.addAmdDepends(sourceIdentifier, gexcludes);
} else {
if (headCloseTagExpr.test(sourceContent)) {
log.debug(3);
Expand Down

0 comments on commit 30d4618

Please sign in to comment.