GitHub小技巧-定義項目語言

來源:互聯網
上載者:User

標籤:git   nbsp   檔案的   block   red   images   code   識別   src   

GitHub是根據項目裡檔案數目最多的檔案類型,識別項目類型。後端項目難免會包含前端的資源,有時候就會被標記成前端語言,因為項目裡 css 等檔案比較多, 被誤識別成css項目。

GitHub不提供指定項目語言的功能,感覺挺傻的。不過可以通過忽略檔案的方式來達到指定語言。

這個項目中前端資源檔都在 public/目錄下。
解決辦法:
在項目根目錄建立 .gitattributes 檔案;
然後就可以使用 linguist-vendored 來忽略目錄下的檔案的語言;

public/* linguist-vendored

作用: 把該檔案夾下的檔案全部忽略。

在檔案比較分散的情況下,可以按檔案的類型進行忽略:

*.css linguist-vendored*.scss linguist-vendored*.js linguist-vendored

GitHub小技巧-定義項目語言

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.