Is it possible to generate multiple Angular components using single angular-cli command like ng generate component comp1, comp2, comp3?
Well, there is nothing as of now by Angular CLI to create multiple components. But this can be done trivially in any shell.
Run this command into your bash shell -
for i in comp1 comp2; do ng g c "${i}"; done
Special thanks to Ingo Bürk's answer
Microsoft Windows variants
In root:
for %n in (component-name-1, component-name-2, ...) do ng g c %n
In module:
for %n in (component-name-1, component-name-2, ...) do ng g c module-name/%n
In module, without tests:
for %n in (component-name-1, component-name-2, ...) do ng g c module-name/%n --skipTests=true
I just created a bash script as
createcomponent.sh
with the following small piece of code
#!/bin/bashwhile [ "$1" != "" ]; do npx ng g c "components/$1" shiftdone
then just call it as
createcomponent.sh comp1 comp2 comp3 ...
The same thing can be done using .bat as well if someone using Windows.npx keyword is not needed if globally installed angular is used