Hugo Pipes as standalone Go module?

I’ve been using Hugo Pipes to concatenate, minify, and fingerprint CSS and it works great! Thank you for this feature!

I’m currently working on an open source Go project (it’s not a Hugo project) and was searching for an asset pipeline that worked in a similar fashion. I came across Hugulp which looks really cool, but seems to require nodejs. I’d love if everything could be done in Go using Pipes, but maybe I don’t understand how this is currently working in Hugo.

Would it be technically feasible to release Hugo Pipes as a Go Module that could be used on other projects that use Go templates, or is that not even possible?

I was poking around and it looks like a lot of the magic might be happening in “resources”:

  • Fingerprinting: resources/resource_transformers/integrity/integrity.go
  • Minifying: resources/resource_transformers/minifier/minify.go and also
    minifiers/minifiers.go with the help of tdewolff/minify
  • Concat: resources/resource_factories/bundler/bundler.go

Everything is possible, but in general I would say that creating a general library is much more work compared to creating something Hugo specific.

Makes sense, thanks @bep!

For anyone interested, the release notes are helpful for understanding the Hugo Pipes implementation.

Also found the go-assetprecomiler project which might suit my needs for go based asset pipeline.

Edit: Forked a version of the project above to add fixes and new features: