Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Angular2 File GeneratorNew to Visual Studio Code? Get it now.
Angular2 File Generator

Angular2 File Generator

Jack Lee

|
5,568 installs
| (0) | Free
Generates angular2 component files (html, css, typescript -> template, stylesheet, component.ts + module.ts + routing.ts + index.ts)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

vscode-angular2-file-generator

This project is Visual Studio Code extension for generating files for akveo / ng2-admin.

This project is based on dbaikov / vscode-angular2-component-generator

Discription

This will generate files listed below :

  • index.ts
  • givenname.component.ts
  • givenname.module.ts
  • givenname.html
  • givenname.scss
  • givenname.routing.ts

when you create sub folder, this will modify your route.ts and module.ts for your convenience. -- v0.0.4

Usage

Operation is same as Great Extension vscode-angular2-component-generator / dbaikov

  • you can check orginal extension here : https://marketplace.visualstudio.com/items?itemName=dbaikov.vscode-angular2-component-generator

Although it is good to use, to simplify my works with ng2-admin I add some files.

To avoid conflicts with based extension, I changed control name to 'New Angular2 Files'.

Config setting files will be generated by names you type.

Configuration

  • global:
    • quotes - single or double in other words ( ' or " )
    • generateFolder - true or false generate or not separate folder for newly created component
    • automodify = true or false modify module.ts and route.ts when create sub folder
  • create true / false - (controls weather to generate this file or not)
  • extension - extension of generated file (e.g. you might want to change "scss" to just plain "css")
  • template - path to the custom template for the generated file
    • {selector} -> replaced with lower case, dash separated string
    • {templateUrl} -> replaced with ${selector}.component.html
    • {styleUrls} -> replaced with ${selector}.component.css
    • {className} -> replaced with componentName in PascalCase

Use the "template" key to override default templates for the extension

{
    "global": {
        "quotes": "single", // or "double",
        "generateFolder": true, // or false,
        "automodify": true      // or false   added v0.0.4
    },
    "files": {
        "component": {
            "create": true,
            "extension": "ts"
            // if needed
            // , "template": "${workspaceRoot}/myComponent.template"
        },
        "css": {
            "create": true,
            "extension": "scss"
            // if needed
            // , "template": "${workspaceRoot}/mycss.template"
        },
        "html": {
            "create": true,
            "extension": "html"
            // if needed
            // , "template": "${workspaceRoot}/myhtml.template"
        },
        "module": {
            "create": true,
            "extension": "ts"
            // if needed
            // , "template": "${workspaceRoot}/mymodule.template"
        },
        "routing": {
            "create": true,
            "extension": "ts"
            // if needed
            // , "template": "${workspaceRoot}/myrouting.template"
        },
        "index": {
            "create": true,
            "extension": "ts"
            // if needed
            // , "template": "${workspaceRoot}/index.template"
        }
    }
}
 

### Change Log
#### 0.0.5 (2017-06-2)
- loadchildren issue fixed

#### 0.0.4 (2017-06-2)
- Modify module.ts, routing.ts when generating sub folder of base folder which has module and routing
    - importing sub component class and make children object with what you named for new folder
    - remove ModuleWithProviders from bottom of routing.ts file
    - default setting is true for this action if you do not want, change automodify to false which added from this version
    - prevent multiple import of same name for creating folders with same names even delete and recreate.
    - can not create folder with the same name if it already exists in the folder
    - generate without template module bug fixed

#### 0.0.3 (2017-06-1)
- generated file is empty issue fixed

#### 0.0.2 (2017-05-25)
- adding any items to files will be generated
    - ex. service : {"create": true,"extension": "ts"} . --> givenname.service.ts 

#### 0.0.1 (2017-05-25)
- release 0.0.1 
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft