我正试图弄清楚Hugo如何在运行hugo server
时(自动(从Github文件夹中提取最新的文件。特别是,我喜欢通过GitHub从PrimerCSS中提取css文件。实现这一点的最佳方法是什么,这样我就不必总是在Git上手动更新Primer CSS了?
我想模块是一种方式(config.yaml(:
module:
imports:
- disable: false
path: github.com/primer/css
mounts:
- source: src/scss
target: assets/scss/primer
然而,当将其添加到config.yaml
时,它似乎不起作用:
Error: module "github.com/primer/css" not found; either add it as a Hugo Module or store it in "/Users/user/code/my-theme/themes".: module does not exist
自动从中提取最新文件有什么简单的最佳实践吗https://github.com/primer/css/(/src(并将其加载到/assets
文件夹中?或者是使用npm节点模块的唯一方法,如下所示:https://github.com/lucperkins/hugo-primer
提前感谢!
我为此挣扎了很长时间。关键是将您的网站初始化为";go模块";通过运行CCD_ 4。这将创建一个go.mod
文件。因此,如果你运行hugo mod init mywebsite
,生成一个go.mod
,看起来像这样:
module mywebsite
go 1.14
require github.com/primer/css v1.0.0 // indirect
之后,这些模块应该可以为您工作。