angular-performance

Optimize Angular applications with NgOptimizedImage, @defer blocks, and SSR hydration.

2|Updated Jun 11, 2024
One-click install
npx skills add https://github.com/gutierrezp22/administracion-departamentos --skill angular-performance-gutierrezp22
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-performance
Source: https://github.com/gutierrezp22/administracion-departamentos/tree/main/.cursor/skills/angular-performance
Command: npx skills add https://github.com/gutierrezp22/administracion-departamentos --skill angular-performance-gutierrezp22

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common performance bottlenecks in Angular applications, ensuring faster load times, smoother user experiences, and improved SEO.

Core Features & Use Cases

  • Image Optimization: Implements NgOptimizedImage for efficient image loading, including priority hints for LCP images and fill mode.
  • Lazy Loading: Utilizes @defer blocks for on-demand loading of components and routes, reducing initial bundle size.
  • SSR & Hydration: Guides on choosing the right rendering strategy (SSR, CSR, SSG) and implementing client-side hydration.
  • Use Case: Optimize an e-commerce product page by ensuring hero images load with priority, deferring non-critical components like reviews, and implementing SSR for better SEO.

Quick Start

Apply NgOptimizedImage to the hero image in your Angular component, setting width, height, and priority.

Frequently Asked Questions about angular-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize Angular application performance using lazy loading?

Optimize Angular performance by utilizing @defer blocks to lazy load components and routes on demand. This reduces the initial JavaScript bundle size, ensuring faster load times and a smoother user experience for your application.

What's the best way to optimize images in an Angular app?

The best way to optimize images in an Angular app is implementing NgOptimizedImage. It enables efficient image loading with priority hints for LCP images and supports fill mode to significantly improve loading speed.

How does server-side rendering with hydration improve Angular SEO?

Server-side rendering with hydration improves Angular SEO by delivering fully rendered HTML content to crawlers. Implementing client-side hydration after SSR preserves interactivity without full page re-rendering, reducing initial load times.

When should I use @defer blocks in my Angular components?

Use @defer blocks when you need to lazy load non-critical Angular components, such as e-commerce product reviews. Deferring these components reduces initial resource loading and improves runtime performance.

Do I need server-side rendering for an Angular e-commerce product page?

Server-side rendering is highly recommended for Angular e-commerce pages to improve SEO. Combine SSR with NgOptimizedImage for priority hero images and deferred non-critical components to maximize speed and efficiency.

What renders better for Angular: SSR, CSR, or SSG?

Choosing the right Angular rendering strategy depends on your needs: SSR improves SEO and initial load, CSR handles dynamic interactivity, and SSG pre-renders static content. Combine SSR with hydration for the best balance of performance and interactivity.