Performance: Creating components with CLI
This affects initial page load speed and bundle size by controlling how components are generated and included in the app.
ng generate component my-component --skip-tests --inline-style --inline-template
ng generate component my-component
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Default CLI component generation | Moderate (extra files increase DOM complexity) | Multiple reflows if many CSS files | Higher paint cost due to separate CSS | [X] Bad |
| CLI component with inline styles/templates and no tests | Lower (fewer files, simpler DOM) | Single reflow | Lower paint cost with inline styles | [OK] Good |
ng generate to create new files and features.ng generate component followed by the component name.ng generate component to create components [OK]header using Angular CLI?ng generate component footer in an Angular project?ng generate component nav-bar but got an error. What is the likely cause?ng generate component, not ng create. Component names can be lowercase.userProfile inside a folder features using Angular CLI. Which command correctly does this?ng generate component features/userProfile to place the component inside the 'features' folder.Pass the test and this pattern moves unknown