Netlifyで failed to transform resource: TOCSS: failed to transform "style.sass" って出た時の対処法

正確なエラー文はこれ

failed to transform resource: TOCSS: failed to transform "style.sass" (text/x-sass): this feature is not available in your current Hugo version

 

結論から行くスタイル

(1)Build image selectionでUbuntu Xenial 16.04(default)を撰ぶ

f:id:yasuhallabo:20200614174032p:plain

  

(2)ローカルとHUGO_VERSIONを合わせたかったら以下で合わせる

f:id:yasuhallabo:20200614174223p:plain

 

これで動くようになりました(・ω・)ノシ

 

ややまどろっこしい説明

・私の場合はMacで開発してた

・hugoはhugo_extendedが入っていた(意識せずに)

$ hugo version
Hugo Static Site Generator v0.58.3/extended darwin/amd64 BuildDate: unknown

・どうやらhugoノーマルはsass対応していないらしい

・netlifyのデフォルトマシンイメージはノーマルhugoらしい

・そこで「Build image selection」で変えてやると動くらしい

・ついでにバージョンを合わせたい場合はHUGO_VERSIONで変えれるらしい。

・HUGO_VERSIONはnetlify.tomlで設定できるという情報もあったが、実際には設定できなかった

 

調査のために開いたリンク

https://discourse.gohugo.io/t/solved-ubuntu-tocss-not-available/14933

https://docs.netlify.com/configure-builds/environment-variables/#netlify-configuration-variables

https://rahilw.dev/blog/hugo-extended-on-netlify/

https://github.com/gohugoio/hugo/releases/