For my Java project which uses Maven I have added Twitters Bootstrap lately to my repository on GitHub. Now I have noticed that my GitHub language statistic changed from
- 100% Java
to
- 66,% Java 33,3% JavaScript
Since I didn’t write the JS part, is there a way to manage that this isn’t counted as mine or how would one normally manage foreign JS code in a GitHub repository or projects in general
I have faced that problem lately, too. There are several ways to deal with it:
use the performance optimized versions, for instance bootstrap.min.js instead of bootstrap.js etc. GitHub uses the file size to determine the language proportion of each repository. This won’t reduce it to zero, but at least it reduces the proportion
This might be what you want: GitHub has a vendor list with regular expressions which are exluced from the language graph. There you will see, that jQuery is already part of the exclusion. There is also a pending pull request to add Twitter Bootstrap. If this does not get pass you can always add the files to a directory called vendor there they will be excluded from the statistics.
use the Maven AntRun Plugin: With it you could simply download the JavaScript library files on request with Ant Get
there are also Maven repositories for these JavaScript libraries: Bootstrap-Maven. However, the files are mounted at
/ext/bootstrap/and I have no idea how this helpsthere are even more solutions, like Maven War Plugin using overlays.
Finally my advice: just put the files into your repository. I have looked into some bigger projects on GitHub using jQuery and Twitter Bootstrap and they all put their JavaScript library files into the repository.
The advantage of these JavaScript library files is that they don’t have to be compiled what so ever. Use this advantage and don’t add additional burdens for the sake of aesthetic. Best practice seems to be adding it to the repository and live with the stupid language graph. Who knows, maybe certain files will be ignored in the future.