How to make GitHub not count some files for the programming language distribution?

Paul Razvan Berg :

If you tap the multicoloured bar underneath the "commits/branch/..." tab bar in a GitHub repo page, you get this distribution of programming languages:

GitHub repo programming language distribution

I'd like to mark some JavaScript files as strictly templates and not source code, so that TypeScript will grow to be the longest in this bar chart. Is this possible?

VonC :

GitHub uses linguist to make the content of the "multicoloured bar underneath".

You can use overrides with .gitattributes directive

Linguist supports a number of different custom override strategies for language definitions and file paths.

File and folder paths inside .gitattributes are calculated relative to the position of the .gitattributes file.

# Example of a `.gitattributes` file which reclassifies `.rb` files as Java:
*.rb linguist-language=Java

When testing with a local installation of Linguist, take note that the added attributes will not take effect until the .gitattributes file is committed to your repository.

lib/linguist/languages.yml does not include just "template", but you can chose another entry for the files you want to exclude from JavaScript.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=390310&siteId=1