4

I am looking for a way to count the total number of line of code for my front-end project.

At the moment I am using the gulp-sloc

gulp.task('sloc', function () {
    gulp.src(folders)
      .pipe(sloc());
});

But the CSS code is not included in the count.

  • Do I miss some special configuration?
  • Do you know any other similar plugin?
GibboK
  • 71,848
  • 143
  • 435
  • 658

2 Answers2

5

Perhaps you are using source control? In case that source control is Git, you can count the amount of code in the repo like this – no extra tools required.

For a more detailed breakdown, cloc may be helpful – have a look at this answer then. cloc doesn't depend on Git, or any other type of source control.

Community
  • 1
  • 1
hashchange
  • 7,029
  • 1
  • 45
  • 41
  • I am using SVN, do you know if there is any similar command on SVN? – GibboK Nov 18 '15 at 09:08
  • I don't, unfortunately. But cloc doesn't depend on Git, so that might work for you (didn't make that clear enough in my answer, I have edited it now). – hashchange Nov 18 '15 at 09:13
  • Thanks for your answer, but rather prefer a solution based on gulp – GibboK Nov 18 '15 at 14:44
  • Also looking at locmetrics's site, I cannot see reference to JS and CSS, I see mainly support for C#, C++, Java, and SQL – GibboK Nov 18 '15 at 14:46
  • @GibboK I think your last comment was meant for the other answer ;) cloc does support CSS and JS: https://github.com/AlDanial/cloc#Languages – hashchange Nov 18 '15 at 16:26
1

In windows OS there is also a gui tool http://www.locmetrics.com/ which you can use to count lines of code (LOC), blank lines of code (BLOC), comment lines of code (CLOC).