安裝 Hugo Bootstrap 模塊

學習如何安裝 Hugo Bootstrap 模塊。

贊助

成為我們的資助者或贊助商,以支持我們的工作。

贊助商

必要條件

一些像 Clearfix 的短代碼需要開啟 markup.goldmark.renderer.unsafe

hugo.yaml

1markup:
2  goldmark:
3    renderer:
4      unsafe: true

hugo.toml

1[markup]
2  [markup.goldmark]
3    [markup.goldmark.renderer]
4      unsafe = true

hugo.json

1{
2   "markup": {
3      "goldmark": {
4         "renderer": {
5            "unsafe": true
6         }
7      }
8   }
9}

導入模塊

hugo.yaml

1module:
2  imports:
3  - path: github.com/hugomods/bootstrap

hugo.toml

1[module]
2  [[module.imports]]
3    path = 'github.com/hugomods/bootstrap'

hugo.json

1{
2   "module": {
3      "imports": [
4         {
5            "path": "github.com/hugomods/bootstrap"
6         }
7      ]
8   }
9}

額外樣式

儘管我們儘量不引入額外的樣式,但還是需要一些額外的樣式來使短代碼看起來更好。

你可以將這些樣式複製到你的站點,又或者使用 Hugo Pipes(推薦)來編譯。

1@import 'mods/bootstrap/scss/index';

命名空間

該模塊具有兩個命名空間:bsbootstrap,兩者均有效,建議使用較短的名稱空間。