And Now: Hugo Pipes!
Hugo 0.43
adds a powerful and very simple to use Assets Pipeline with SASS and SCSS with source map support, PostCSS and minification and fingerprinting and Subresource Integrity and … much more. Oh, did we mention that you can now do ad-hoc image processing and execute text resources as Go templates?
An example pipeline:
{{ $styles := resources.Get "scss/main.scss" | toCSS | postCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">
To me, the above is beautiful in its speed and simplicity. It could be printed on a t-shirt. I wrote in the Hugo Birthday Post some days ago about the value of a single binary with native and fast implementations. I should have added simplicity as a keyword. There seem to be a misconception that all of this needs to be hard and painful.
New functions to create Resource
objects:
resources.Get
resources.FromString
: Create a Resource from a string.
New Resource
transformation funcs:
resources.ToCSS
: CompileSCSS
orSASS
intoCSS
.resources.PostCSS
: Process your CSS with PostCSS. Config file support (project or theme or passed as an option).resources.Minify
: Currently supportscss
,js
,json
,html
,svg
,xml
.resources.Fingerprint
: Creates a fingerprinted version of the given Resource with Subresource Integrity.resources.Concat
: Concatenates a list of Resource objects. Think of this as a poor man’s bundler.resources.ExecuteAsTemplate
: Parses and executes the given Resource and data context (e.g. .Site) as a Go template.
I, @bep, implemented this in dea71670. We will work hard to get the documentation up to date, but follow the links above for details, and also see this demo project.
This release represents 35 contributions by 7 contributors to the main Hugo code base. @bep leads the Hugo development with a significant amount of contributions, but also a big shoutout to @anthonyfok, @openscript, and @caarlos0 for their ongoing contributions. And a big thanks to @digitalcraftsman for his relentless work on keeping the themes site in pristine condition and to @kaushalmodi for his great work on the documentation site.
Many have also been busy writing and fixing the documentation in hugoDocs, which has received 11 contributions by 5 contributors. A special thanks to @bep, @danrl, @regisphilibert, and @digitalcraftsman for their work on the documentation site.
Hugo now has:
- 26968+ stars
- 443+ contributors
- 238+ themes
Notes
- Replace deprecated {Get,}ByPrefix with {Get,}Match 42ed6025 @anthonyfok
- Hugo is now released with two binary version: One with and one without SCSS/SASS support. At the time of writing, this is only available in the binaries on the GitHub release page. Brew, Snap builds etc. will come. But note that you only need the extended version if you want to edit SCSS. For your CI server, or if you don’t use SCSS, you will most likely want the non-extended version.
Enhancements
Templates
- Return en empty slice in
after
instead of error f8212d20 @bep #4894 - Update internal pagination template to support Bootstrap 4 ca1e46ef @bep #4881
- Support text/template/parse API change in go1.11 9f27091e @anthonyfok #4784
Core
- Allow forward slash in shortcode names de37455e @bep #4886
- Reset the global pages cache on server rebuilds 128f14ef @bep #4845
Other
- Bump CircleCI image e3df6478 @bep
- Add Goreleaser extended config 626afc98 @bep #4908
- Build both hugo and hugo.extended for 0.43 e1027c58 @anthonyfok #4908
- Add temporary build script bfc3488b @bep
- Add “extended” to “hugo version” ce84b524 @anthonyfok #4913
- Add a newScratch template func 2b8d907a @bep #4685
- Add Hugo Piper with SCSS support and much more dea71670 @bep #4381#4903#4858
- Consider root and current section’s content type if set in front matter c790029e @bep #4891
- Update docker image 554553c0 @bep
- Merge branch ‘release-0.42.2’ 282f6035 @bep
- Release 0.42.2 1637d12e @bep
- Update GoReleaser config 1f0c4e1f @caarlos0
- Create missing head.html partial on new theme generation fd71fa89 @openscript
- Add html doctype to baseof.html template for new themes b5a3aa70 @openscript
- Adds .gitattributes to force Go files to LF 6a2968fd @neurocline
- Update to Go 1.9.7 and Go 1.10.3 23d5fc82 @anthonyfok
- Update Dockerfile to a multi-stage build 8531ec7c @skoblenick #4154
- Release 0.42.1 d67e843c @bep
- Do not fail server build when /static is missing 34ee27a7 @bep #4846
Fixes
Improve this page