Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Log home many files have been modified by usemin #493

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/fileprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,7 @@ FileProcessor.prototype.process = function (filename, assetSearchPath) {

var content = this.replaceWithRevved(this.replaceBlocks(this.file), this.file.searchPath);

this.isFileModified = !!this.file.blocks.length || (this.file.content !== content);

return content;
};
9 changes: 7 additions & 2 deletions tasks/usemin.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ module.exports = function (grunt) {
nonull: true,
filter: 'isFile'
}, fileObj.src);
var fileModified = 0;
files.forEach(function (filename) {
debug('looking at file %s', filename);

Expand All @@ -142,14 +143,18 @@ module.exports = function (grunt) {
// Our revved version locator
var content = handler.process(filename, options.assetsDirs);

// write the new content to disk
grunt.file.write(filename, content);
if (handler.isFileModified) {
// write the new content to disk
grunt.file.write(filename, content);
fileModified++;
}

});

grunt.log.writeln('Replaced ' + chalk.cyan(files.length) + ' ' +
(files.length === 1 ? 'reference' : 'references') + ' to assets'
);
grunt.log.writeln('Real changed ' + chalk.cyan(fileModified) + ' file' + (fileModified > 1 ? 's' : '') + '.');
});
});

Expand Down