build(aio): auto-fill width/height to all image tags

Parse all `<img>` tags, during doc-gen, and insert the width and height of
the sourceed image, if neither are already specified.

Warnings are reported if the `<img>` tag has no `src` attribute or the image
cannot be loaded.

The work is done in the `addImageDimensions` post-processor, which must be
configured with a `basePath` so that it knows where to find the images.

Closes #15888
This commit is contained in:
Peter Bacon Darwin
2017-04-28 15:05:05 +01:00
committed by Matias Niemelä
parent 64335d3521
commit ca17d4f639
7 changed files with 177 additions and 5 deletions

View File

@ -1,6 +1,7 @@
module.exports = function copyContentAssetsProcessor(copyFolder) {
return {
$runBefore: ['postProcessHtml'],
assetMappings: [],
$process() {
this.assetMappings.forEach(map => {