Kotsu
Kotsu copied to clipboard
`createImage()` function
Somehow related to https://github.com/LotusTM/Kotsu/issues/266.
I always wasn't that fond of how we treat images manipulation with Grunt plugin, since it doesn't scale well, and any attempts to change just certain portion of images will always end up with messy, unmaintainable, and, what is worst, hard to get to what related Grunt config.
Instead, we have to make createImage()
function, which could be used in Nunjucks or Sass, and which will allow to generate any images on demand.
Recently I saw something very similar to what I want: gatsby-plugin-sharp
The only bummer for now is the performance. We need some way of caching, or index graph, which will store information about which images were already processed and exists, to ensure that when you watch Nunjucks or Sass files, you don't wait few minutes just due to recurring generation process of images, which already exists.
Another concern is build generation. It somehow worries me that in large projects with thousands of images it will be forced to run image generation each time you make a new build, and it will take a lot of time. I wonder, is it possible to leverage some sort of local and CI caching here...