antwarjs / antwar

A static site generator built with React and Webpack.
https://antwar.js.org/
MIT License
460 stars 35 forks source link

Figure out how to deal with blog post thumbnails #24

Closed bebraw closed 7 years ago

bebraw commented 9 years ago

It would be nice if it was possible to generate thumbnails for blog post images. I expect this would be some sort of custom tag.

Given a blog might have a lot of images, I guess this should be an incremental process (generate just missing thumbnail images to the build assets?).

eldh commented 9 years ago

I'm thinking a plugin could do this. We have postProcess and writeExtras that should be enough, hopefully.

bebraw commented 9 years ago

Yeah, writeExtras would be enough. It probably should maintain some metadata so it's smart enough to update only those thumbnails that have changed and create missing ones (just some index somewhere).

Maybe this needs to be accompanied with a React tag that can rely on some convention. This also needs to be parametrized somehow (ie. image max size and so on).

Actually now that I think of it, it would probably make most sense to have the configuration per thumbnail at tag level. That would give most control over the result. Then the problem becomes how to pass that data to writeExtras.

bebraw commented 7 years ago

This is doable on webpack side now in a custom loader quite trivially. No need for a specific Antwar plugin as it's a webpack problem now.