在我的项目中,我有一个小脚本,运行一些构建脚本来准备我的开发人员。但是,我当前的配置导致了一个错误。它在错误的位置查找主题目录。
我的构建脚本位于根目录中。我的雨果应用程序在frontend/上。我想从route调用构建脚本,让它构建hugo。
/my-project
/frontend
/custom-theme
build-script.sh我的frontend/config.toml
baseURL = "https://site.local"
title = "Site Title"
themesDir = "themes"
theme = "custom-theme"
disableKinds = [ "taxonomyTerm", "taxonomy", "robotsTXT" ]当我使用以下命令从build目录运行我的构建脚本时,我得到一个错误:
# Build HTML and CSS
npm run build:dev --prefix $PWD/frontend/themes/custom-theme
# Hugo frontend
hugo --config $PWD/frontend/config.dev.toml
# Build PHP dependencies
composer install -d $PWD/api/错误:
Error: Unable to find theme Directory: C:\Users\James\Projects\my-project\themes\custom-theme它缺少路径的\frontend部分。它应该是:
C:\Users\James\Projects\my-project\frontend\themes\custom-theme有没有可能告诉hugo在哪里寻找主题?
发布于 2018-10-15 21:05:33
听起来Hugo假设你的路径是相对于当前目录的。您是从C:\Users\James\Projects\my-project目录构建的,所以当Hugo将其与您的themes的themesDir设置放在一起时,它将得到C:\Users\James\Projects\my-project\themes。相反,可以尝试设置themesDir = "frontend\themes"。
由此推论,如果您希望Hugo的行为与从frontend目录构建时一样,则还需要设置所有其他目录选项。例如,您需要设置contentDir = "frontend\content"和layoutDir = "frontend\layout"。您可以检查哪些目录在Hugo documentation中是可配置的。
不过,需要注意的是:我还没有亲自测试过,所以如果它不工作,这可能就是原因所在。:)
https://stackoverflow.com/questions/52749290
复制相似问题