Currently I use kiln to compress my source images for faster downloading
on the web, in `config.toml` as follows:
```
[[tasks]]
input = [".jpg", ".jpeg", ".png"]
output = ".jpg"
preprocess.jpg = "magick /dev/stdin -strip -interlace Plane
-gaussian-blur 0.05 -quality 85% /dev/stdout"
output_dir = "public"
ugly_urls = true
```
However, this leads to quite slow build times.
Without trying to reinvent `make` et. al, could this be addressed
through differential builds, where tasks aren't run on files that
haven't changed since last build?
On Wed May 3, 2023 at 9:00 AM EDT, Edd Salkield wrote:
> Currently I use kiln to compress my source images for faster downloading> on the web, in `config.toml` as follows:>> ```> [[tasks]]> input = [".jpg", ".jpeg", ".png"]> output = ".jpg"> preprocess.jpg = "magick /dev/stdin -strip -interlace Plane> -gaussian-blur 0.05 -quality 85% /dev/stdout"> output_dir = "public"> ugly_urls = true> ```>> However, this leads to quite slow build times.>> Without trying to reinvent `make` et. al, could this be addressed> through differential builds, where tasks aren't run on files that> haven't changed since last build?
I don't think this fits well with the design of kiln. In many cases you
want to rebuild the content even when the files haven't changed since
the last build. For example, you might use the site.Generated timestamp
in your site, which needs to be updated on every build. Also, most
builds are fast enough that this is not a big issue.
Alternatively, I am open to adding a way to run or skip certain tasks
instead of running all tasks every time. However, I think it might be
best to use a Makefile or equivalent to compress the images instead of
using kiln to do it.
> For example, you might use the site.Generated timestamp> in your site, which needs to be updated on every build.
Good point.
> Alternatively, I am open to adding a way to run or skip certain tasks> instead of running all tasks every time.
Some sort of task-level setting to skip the task based on build time or
something could be good.
> However, I think it might be> best to use a Makefile or equivalent to compress the images instead of> using kiln to do it.
Some sort of Makefile wildcard could be used for this[1]. It's a bit of
a hack though, because you have to write rules to match file extensions
and put them in the correct output directory, essentially reimplementing
the behaviour of kiln.
[1]: https://stackoverflow.com/questions/58645889/makefile-wildcard-with-multiple-file-extensions