Skip to content

Commit

Permalink
resource: Add instruction to install PostCSS when missing
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyfok committed Aug 25, 2018
1 parent 66f688f commit 3465fa5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion resource/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3465fa5

Please sign in to comment.