Git Product home page Git Product logo

vscode-file-template's Introduction

rhangai.file-template vscode extension

Generate templates from a single file or multiple files

Creating files

Right click in your explore panel and select Create from template

Single file template

The gif belows create a single file from the Component template

Image

Folder templates

The gif belows create 3 files: clients-hooks.ts, clients.spec.ts, clients.tsx

Image

Creating templates

Create a .vscode/templates folder in your project root

File templates

Just create a new file inside the templates dir. Every file will be considered a new template.

Folder templates

Folder templates allow the creationg of multiple files. Every file inside the template folder will be created in the destination. (Template substitution applies for every file)

Template substitution

Every template is compiled through mustache. So you can use {{ var }} substitution

The following variables are allowed in template substitution

  • name: User input when creating templates
  • dir: Base dir destination name
  • namePrefix: Name prefix (param-case by default)
  • nameSuffix: Name suffix (param-case by default)
  • nameWithoutExt: Name without an extension (Ex: my-class.cpp would become my-class)
  • nameWithoutPrefix: Name without prefix (param-case by default)
  • nameWithoutSuffix: Name without suffix (param-case by default)

You can also use the following variants for each var

  • varParam: The variable var param cased (some-name)
  • varCamel: The variable var camel cased (someName)
  • varPascal: The variable var pascal cased (SomeName)
  • varSnake: The variable var snake cased (some_name)
  • varConstant: The variable var snake cased (SOME_NAME)
  • varDot: The variable var snake cased (some.name)

If the name is my-niceTemplate-create

Var Value
name my-niceTemplate-create
nameParam my-nice-template-create
nameSnake my_nice_template_create
nameCamel myNiceTemplateCreate
namePascal MyNiceTemplateCreate
nameConstant MY_NICE_TEMPLATE_CREATE
nameDot my.nice.template.create
namePrefix my
nameSuffix create
nameWithoutPrefix nice-template-create
nameWithoutSuffix my-nice-template

If the name is my-niceTemplate-create.java

Var Value
name my-niceTemplate-create.java
nameWithoutExt my-niceTemplate-create
nameWithoutExtPascal myNiceTemplateCreate

vscode-file-template's People

Contributors

quinton22 avatar rhangai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.