antwarjs / antwar

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

Implement a screenshot plugin #55

Closed bebraw closed 7 years ago

bebraw commented 9 years ago

It would be useful if it was possible to generate screenshots based on sites within blogposts. I've used syntax like {{ screenshot: url }} in another system but that can be changed. On general level you probably should be able to configure screenshot size at least.

I expect this would generate a screenshot and then replace the custom markup with either Markdown image declaration or some HTML. This could be achieved by hooking into marked processing. That's quite easy. In terms of Webpack that might be just a loader. Or we could do a cruder replace like in the case of highlight-loader. That might be a good starting point.

I have written a little library that can output screenshots in multiple resolutions: https://github.com/bebraw/webshotter . Alternatively we could just go with node-webshot and leave that out of the plugin. In that case thumbnails could get generated by some other plugin.

bebraw commented 7 years ago

It's possible to handle this through a webpack loader in the current architecture if needed. No need for a plugin.