Hugo をインストールして、公式ドキュメントなどを参考にフルスクラッチで静的サイトを構築しようと考えています。(Netlify CMS)
SASSを使ってCSSを書きたいのですが、うまく読み込めません。
なぜだかわかりますでしょうか。
調査したページ
https://gohugo.io/hugo-pipes/scss-sass/
https://discourse.gohugo.io/t/custom-css-throws-type-nil-not-supported-in-resource-transformations/19942
#ファイル構成
基本的には hugo install したときのままです。
- layouts/index.html # 今回のコードはこちらに書いています。
- resources/_gen/assets/sass/main.scss #こちらのファイルには html {background: yellow} とだけ書かれています。
index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Document</title> <script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script> {{ $sassTemplate := resources.Get "sass/main.scss" }} {{ $style := $sassTemplate | resources.ExecuteAsTemplate "main.scss" . | resources.ToCSS }} <link rel="stylesheet" href="{{ $style.relURL }}"> </head> <body> <h1>Nice. It's looking good already.</h1> <ul> {{ range (where .Pages "Section" "blog") }} <li> <a href="{{ .RelPermalink }}"> {{ .Title }} </a> </li> {{ end }} </ul> </body> </html>
エラー
Rebuild failed: Failed to render pages: render of "home" failed: "/Users/リポジトリの名前/layouts/index.html:11:40": execute of template failed: template: index.html:11:40: executing "index.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type <nil> not supported in Resource transformations ↓ <script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script> {{ $sassTemplate := resources.Get "sass/main.scss" }} {{ $style := $sassTemplate | resources.ExecuteAsTemplate "main.scss" . | resources.ToCSS }} <link rel="stylesheet" href="{{ $style.relURL }}"> </head> hugo v0.81.0+extended darwin/amd64 BuildDate=unknown
あなたの回答
tips
プレビュー