Skip to content

Commit

Permalink
Merge pull request #19 from srigi/fixConsoleCounter
Browse files Browse the repository at this point in the history
Fix counter of converted files, fixes #18
  • Loading branch information
karlgoldstein committed Nov 27, 2013
2 parents cccbd1e + c81ea52 commit d779bfe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,6 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.

0.2.0 Add htmlmin option (pull request #16, thanks @buberdds)

0.2.1 Fix dependencies for htmlmin (pull request #17, vielen dank @mlegenhausen)
0.2.1 Fix dependencies for htmlmin (pull request #17, vielen dank @mlegenhausen)

0.2.2 Fix counter of converted files (pull request #18, thanks @srigi)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "grunt-html2js",
"description": "Compiles AngularJS templates to JavaScript",
"version": "0.2.1",
"version": "0.2.2",
"homepage": "https://github.com/karlgoldstein/grunt-html2js",
"author": {
"name": "Karl Goldstein",
Expand Down
9 changes: 7 additions & 2 deletions tasks/html2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ module.exports = function(grunt) {
htmlmin: {}
});

var counter = 0;

// generate a separate module
this.files.forEach(function(f) {

Expand All @@ -117,7 +119,10 @@ module.exports = function(grunt) {
grunt.fail.fatal('Unknow target "' + options.target + '" specified');
}

}).join('\n');
});

counter += modules.length;
modules = modules.join('\n');

var fileHeader = options.fileHeaderString !== '' ? options.fileHeaderString + '\n' : '';
var fileFooter = options.fileFooterString !== '' ? options.fileFooterString + '\n' : '';
Expand All @@ -135,7 +140,7 @@ module.exports = function(grunt) {
grunt.file.write(f.dest, grunt.util.normalizelf(fileHeader + bundle + modules + fileFooter));
});
//Just have one output, so if we making thirty files it only does one line
grunt.log.writeln("Successfully converted "+(""+this.files.length).green +
grunt.log.writeln("Successfully converted "+(""+counter).green +
" html templates to " + options.target + ".");
});
};

0 comments on commit d779bfe

Please sign in to comment.