Skip to content

Instantly share code, notes, and snippets.

@mugan86
Created May 12, 2021 19:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mugan86/5a72bc2edfc0866fa270cf6616c0c696 to your computer and use it in GitHub Desktop.
Save mugan86/5a72bc2edfc0866fa270cf6616c0c696 to your computer and use it in GitHub Desktop.
Overriding Schematics in Angular project - angular.json

En este video os voy a explicar como reescribir algunas configuraciones que tenemos por defecto cuando trabajamos con un proyecto de angular. Para ello lo vamos a modificar todo dentro del angular.json añadiendo las opciones que más interesantes nos resulten.

Creamos el proyecto con las siguientes configuraciones

Añadimos un proyecto sencillo de Angular, donde establecemos sin rutas y con estilos por defecto "CSS" ng new schematics-overriding-configs --routing --style=css

Configurar las diferentes opciones para establecer bajo nuestras preferencias

https://angular.io/cli/generate

Podemos crear proyectos y con ello, ir pasando la información a esas librerías

ng g library

Y en el schematics con los componentes y otros elementos, podemos especificar el proyecto.

"schematics": {
"@schematics/angular:application": {
"strict": true,
"style": "css",
"routing": false
},
"@schematics/angular:module": {
"routing": false
},
"@schematics/angular:pipe": {
"skipTests": true,
"skipImport": true,
"project": "anartzlibrary"
},
"@schematics/angular:service": {
"skipTests": true
},
"@schematics/angular:library": {
"entryFile": "api"
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment