This extension allows quickly scaffold angular 2 file templates in VS Code project.
Inspired by angular-cli (https://github.com/angular/angular-cli)
You can now leverage angular-cli resource generation options without remembering their names, while keeping things simple and fast!
"my-component -o"
- Use "-o" flag to specify which options to override"my-component --inline-style -t"
- Specify resource generation options without invoking options window"my-component --inline-style --prefix dsdds -o"
- Use both modes togetherAngular Files will automatically scan you angular.json to determine which default options you have already set and will let you to override them while displaying the current values
"angular2-files.menu.class": false,
"angular2-files.menu.component": true,
"angular2-files.menu.directive": true,
"angular2-files.menu.enum": false,
"angular2-files.menu.interface": false,
"angular2-files.menu.module": false,
"angular2-files.menu.pipe": true,
"angular2-files.menu.route": false,
"angular2-files.menu.service": true
"defaults": {
"styleExt": "css",
"component": {
"spec": true,
"inlineStyle": false,
"inlineTemplate": false,
"flat": false,
"changeDetection": "Default",
"viewEncapsulation": "Emulated"
},
"class": {
"spec": false
},
"directive": {
"flat": true,
"spec": true
},
"guard": {
"flat": true,
"spec": true
},
"interface": {
"prefix": ""
},
"module": {
"flat": false,
"spec": false
},
"pipe": {
"flat": true,
"spec": true
},
"service": {
"flat": true,
"spec": true
}
}
Right click on a file or a folder in your current project. You can find multiple options been added to the context menu:
Menu Options |
---|
New Component |
New Directive |
New Pipe |
New Service |
New Module |
Menu Options |
---|
New Class |
New Interface |
New Enum |
Override default configuration like app prefix and style: Create a angular-cli.json (can be used without angular-cli):
{
"apps":[
{
"root":"src",
"prefix":"app"
}
],
"defaults":{
"styleExt":"css"
}
}
The naming of the files as well as the (boilerplate) snippets are based on the official Angular Style Guide
Ctrl
-Shift
-P
(Windows, Linux) or Cmd
-Shift
-P
(OSX)Install Extension
angular files
and press enterImportant: This extension due to the nature of it's purpose will create files on your hard drive and if necessary create the respective folder structure. While it should not override any files during this process, I'm not giving any guarantees or take any responsibility in case of lost data.
MIT