Read values from gulpfile.js?

I produce my responsive images with gulp. In that gulpfile.js I have variables like small = 320, medium = 768 and large = 1200 which are used by the gulp-responsive plugin.

It would be great if I could read those values into a partial/srcset.html for implementing the correct images attributes like suffix or w.

Currently I have those values in data/srcset.toml from where I can bring them in the partial. But I have to maintain 2 sources.

Any idea?

process.env.SMALL = small

And then in template

{{ $small := getenv "SMALL" }}

A related tip:

process.env.HUGO_BASEURL = "https://example.com"
1 Like