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:

committed by
Matias Niemelä

parent
64335d3521
commit
ca17d4f639
@ -34,6 +34,9 @@ module.exports = new Package('angular-base', [
|
||||
.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); })
|
||||
.factory(require('./readers/json'))
|
||||
.factory(require('./services/copyFolder'))
|
||||
.factory(require('./services/getImageDimensions'))
|
||||
|
||||
.factory(require('./post-processors/add-image-dimensions'))
|
||||
|
||||
.config(function(checkAnchorLinksProcessor) {
|
||||
// This is disabled here to prevent false negatives for the `docs-watch` task.
|
||||
@ -120,9 +123,11 @@ module.exports = new Package('angular-base', [
|
||||
})
|
||||
|
||||
|
||||
.config(function(postProcessHtml) {
|
||||
.config(function(postProcessHtml, addImageDimensions) {
|
||||
addImageDimensions.basePath = path.resolve(AIO_PATH, 'src');
|
||||
postProcessHtml.plugins = [
|
||||
require('./post-processors/autolink-headings')
|
||||
require('./post-processors/autolink-headings'),
|
||||
addImageDimensions
|
||||
];
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user