From 08d14113b60ff70ffe922e8098e289b099a70e0f Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Fri, 24 Aug 2018 23:06:23 -0600 Subject: [PATCH] resource: Add instruction to install PostCSS when missing Fixes #5111 --- resource/transform.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resource/transform.go b/resource/transform.go index b2c63057a..c81748756 100644 --- a/resource/transform.go +++ b/resource/transform.go @@ -391,7 +391,11 @@ func (r *transformedResource) transform(setContent bool) (err error) { // If a prepared bundle for this transformation chain is available, use that. f := r.tryTransformedFileCache(key) if f == nil { - return fmt.Errorf("%s: failed to transform %q (%s): %s", strings.ToUpper(tr.transformation.Key().name), tctx.InPath, tctx.InMediaType.Type(), err) + errMsg := err.Error() + if tr.transformation.Key().name == "postcss" { + errMsg = "PostCSS not found; install with \"npm install postcss-cli\". See https://gohugo.io/hugo-pipes/postcss/" + } + return fmt.Errorf("%s: failed to transform %q (%s): %s", strings.ToUpper(tr.transformation.Key().name), tctx.InPath, tctx.InMediaType.Type(), errMsg) } transformedContentr = f defer f.Close()