cgag / loc

Count lines of code quickly.
MIT License
2.29k stars 126 forks source link

vue.js support #88

Open Ray-Eldath opened 6 years ago

Ray-Eldath commented 6 years ago

Requesting supportance for vue.js as loc can not parse '.vue' yet...

snipaste_2018-05-13_15-57-54

Many thanks!

cgag commented 6 years ago

I don't know much about vue.js, can you confirm that this just requires counting .vue files as .js files, or does it have it have it's own comment syntax? Should it be counted as its own thing (that's what we do for JSX files right now, they're listed separately from javascript)?

Thanks for pointing this one out.

Ray-Eldath commented 6 years ago

Ah... I think add supportance for vue.js is simple, for loc have been support HTML, CSS and JavaScript yet... .vuefile contains HTML, CSS and JS code in one file: CSS codes are in style tag, HTML codes are in template tag, JavaScript codes are in script tag. Overall, resolved .vue as a .html that contains HTML, CSS and JavaSciprt maybe works.

Check ArticleCard.vue for an instance.

jhpratt commented 6 years ago

@cgag I just tried adding in .vue, using a combination of HTML, JS, CSS, Pug, and CoffeeScript comments. Ran into a bug — it counted 9 comment lines, zero blank. It reported the total as the binary negation of 9. This doesn't appear to be isolated, as running loc on the source for loc does the exact same thing for handlebars. I've no clue why, but I know it's not my (attempted) addition.

The number of comment line is correct, it's just completely messing up everything else.