| Marketplace
Sign in
Visual Studio Code>Other>Create Item By TemplateNew to Visual Studio Code? Get it now.

Create Item By Template

lanten

|
151 installs
| (2) | Free
Create a folder quickly using a template
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

create-item-by-template

Version Installs

This extension can help you quickly create a folder using a template

Right click to create :

1

Command to create :

2

Commands

cmd + shift + p

  • Create: Create item by template
  • Create: Edit template (Global)
  • Create: Edit template (Workspace)}

Edit template

You can edit template at global and workspace

example:

module.exports = {
  'web-project': (name, config) => {

    // If you input path: ppp/xx-xxx?type=1
    // You will get arguments: (xx-xxx,{type:'1'})

    const { type } = config
    return {
      [`${name}.html`]: [
        `<!DOCTYPE html>`,
        `<html lang="en">`,
        `<head>`,
        `  <meta name="viewport" content="width=device-width, initial-scale=1.0">`,
        `  <meta http-equiv="X-UA-Compatible" content="ie=edge">`,
        `  <script src="./${name}.js"></script>`,
        `  <title>${name}</title>`,
        `</head>`,
        `<body>`,
        `  ${type ? 'type ' + type : ''}`,
        `</body>`,
        `</html>`,
      ],
      [`${name}.js`]: [
        `console.log('${name} ok')`,
      ]
    }
  },
}

欢迎使用中文反馈建议及问题 https://github.com/lanten/create-by-template/issues

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2019 Microsoft