简体   繁体   English

如何计算项目中JS,CSS,LESS,HTML文件的代码行总数?

[英]How to count the total number of line of code for JS, CSS, LESS, HTML files in a project?

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-sloc

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

But the CSS code is not included in the count. 但是CSS代码不包括在计数中。

  • Do I miss some special configuration? 我会错过一些特殊的配置吗?
  • Do you know any other similar plugin? 您知道其他类似的插件吗?

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. 如果源代码控制是Git,则可以像这样计算存储库中的代码量-不需要额外的工具。

For a more detailed breakdown, cloc may be helpful – have a look at this answer then. 有关更详细的分类, cloc可能会有所帮助–然后查看此答案 cloc doesn't depend on Git, or any other type of source control. cloc不依赖于Git或任何其他类型的源代码控制。

在Windows OS中,还有一个gui工具http://www.locmetrics.com/ ,您可以使用它来计算代码行(LOC),代码空行(BLOC),代码注释行(CLOC)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM