Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(common): add <link> preload tag on server for priority img
While in Angular Universal, for images that are priority add a preload tag to the to ensure the image is preloaded before it is rendered. This resolves a warning when running Lighthouse. docs(common): add explanation for ng optimized image constants Add documentation for the default image limit and preloaded images injection token fix(common): use plain method parameters for createPreloadLinkTag Convert method back to plain method parameters instead of spread object docs(common): explain each of the params for createPreloadLinkTag Add additional documentation explaining the parameters to the `createPreloadTag` method docs(common): remove private annotation from create function Remove `@private` annotation from method for creating preload link test(common): ensure max preload limit is abided by Test to ensure that the limit of images is abided by when in the browser and server test(common): update preload tests to match on original ngSrc Wrap preload tests in describe, change references to `preconnect` to `preload` and use original `ngSrc` for the `preload` href instead of the rewritten `src` docs(common): explain why imagesizes and imagesrcset are set on link tag Add comment and link to external resource for why imagesizes and imagesrecset are set on the preload link tag from the sizes attribute and formatted srcset property docs(common): update goldens for NgOptimizedImage Update golden file to no longer have ng optimized image config token that was removed docs(common): more clearly explain max preloaded image limit Update error thrown in `ngDevMode` to more clearly explain what the issue is fix(common): use src instead of url for preload tag function Src is more accurate when referencing an `<img>` tag docs(common): use nodoc on sizes input Use `@nodoc` to keep it in DTS files but remove it from documentation fix(common): forward sizes and srcset to preload link tag Set imagesrcset and imagesizes on preload `<link>` tag fix(common): remove config for optimized image directive Remove the config injection token for the NgOptimizedImage directive and use the default constant directly feat(common): do not duplicate ng optimized preload tags Do not duplicate the preload `<link>` tags for images that show up more than once and throw a `RuntimeError` if there are too many preloaded images. test(common): switch to ngSrc from rawSrc update test for preload link to use ngSrc instead of removed rawSrc fix(common): do not add fetchpriority to preload link tag `fetchpriority` is not needed on preload image `<link>` tags, an image inside an `<img>` tag with `fetchpriority` set to `high` is sufficient. fix(common): add missing semicolon formats ng_optimized_image.ts file to add missing semicolon fix(common): use setAttribute instead of assign to as Chrome throws a warning about `as` not being a valid value for a preload attribute is we set it by assigning to the value to the `as` property on the preload element. Instead, if we use `setAttribute` the `as` property is correctly set on the element. fix(common): change to relative paths for server check imports Fix imports to `DOCUMENT` DI token and `isPlatformServer` function to remove circular dependencies feat(common): add <link> preload tag on server for priority img While in Angular Universal, for images that are priority add a preload <link> tag to the <head> to ensure the image is preloaded before it is rendered. This resolves a warning when running Lighthouse. docs(common): update doc for createPreloadTag fix(common): use set host attribute for sizes Ensure that sizes is set on the host attribute fix(common): move preload link creation to service fix(common): use rewritten src for preload link href test(common): switch quotes back to double quotes fix(common): pass Renderer2 in from directive to create <link> fix(common): use setAttribute instead of setProperty Add tests to ensure that setAttribute is setting rel, as, imagesizes and imagesrcset correctly
- Loading branch information