Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added option to only write out files that have unused dependencies #5

Merged
merged 3 commits into from Apr 21, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions tasks/amdcheck.js
Expand Up @@ -47,7 +47,8 @@ module.exports = function(grunt) {
logDependencyNames: false,
logUnusedDependencyPaths: true,
logUnusedDependencyNames: false,
removeUnusedDependencies: true
removeUnusedDependencies: true,
onlyFilesWithUnusedDependencies: false
});

options.logFilePath = options.logFilePath || options.logDependencyPaths || options.logDependencyNames || options.logUnusedDependencyPaths || options.logUnusedDependencyNames;
Expand Down Expand Up @@ -105,7 +106,9 @@ module.exports = function(grunt) {
}

if (options.removeUnusedDependencies) {
grunt.file.write(dest, processResult.optimizedContent);
if (!options.onlyFilesWithUnusedDependencies || (results.length > 0 && fileHasUnusedDependencies)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is no need to check for results.length > 0, right?

grunt.file.write(dest, processResult.optimizedContent);
}
}
});
});
Expand Down