Schematics are great! They enable us to achieve more in shorter amount of time! But most importantly, we can think less about mundane stuff which leaves our limited attention span to focus on solving real challenges!
☕☕☕☕☕ 20 minutes read
⚠️ This is a pretty long article which gets into every detail of implementing custom Angular schematics…
This article will teach you how to create tailor made schematics specific to the needs of your project or organization! It will empower you and your colleagues to become much more productive!
Feel free to skip straight to the part dealing with the specific topic you are interested in. That way you can fill in the blanks in your pre-existing Angular schematics knowledge!
What are we going to learn?
- Create custom schematics project workspace
- Concepts that describe schematics implementation (Factory, Rule, Tree…)
- Build schematics (and setup watch build for convenience)
- Run schematics (package vs relative path, debug mode, …)
- Implement simple schematics (generate a file, …)
- Parametrize schematics with schema and options
- Use advanced schematics templates (and string helper functions)
- Integrate custom schematics in Angular CLI worksapce
- Test custom schematics
- Build and publish custom schematics package
- Implement schematics as a part of Angular library project
Before we start, we have to install
@angular-devkit/schematics-cli package to be able to to use
schematics command in our terminal. This command is similar to well-known
ng generate but the main advantage is that we can run it anywhere because it’s completely independent from the…