Hugo: Feature request: ESBuild pipeline

Created on 26 May 2020  路  3Comments  路  Source: gohugoio/hugo

ESBuild is a very fast JavaScript bundler written in Go. It would be nice if in addition to minifying out of the box, Hugo could also bundle JS files.

Usage might looks like:

{{ $jsOptions := dict "minify" true "sourceMap" false "module" true }}
{{ $js := resources.Get "js/entrypoint.js" | toJSBundle $jsOptions | fingerprint }}
<script type="module" src='{{ $js.RelPermalink }}'></script>

And entrypoint.js could import files in the ES6 style:

import { onLoad } from './utils.js';
import myFunc from './my-func.js';

onLoad(myFunc);

With all the concatenation and tree shaking happening automatically.

Proposal

Most helpful comment

I thought you were the Hugo boss? If it's not you, then is it him?

All 3 comments

How did that project get under my radar? Oh, well, hope the Hugo boss accepts this proposal.

I thought you were the Hugo boss? If it's not you, then is it him?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

geddski picture geddski  路  3Comments

antifuchs picture antifuchs  路  3Comments

ianbrandt picture ianbrandt  路  3Comments

vielmetti picture vielmetti  路  3Comments

chrissparksnj picture chrissparksnj  路  3Comments