Giter VIP home page Giter VIP logo

file-templates-manager's Introduction

File Templates Manager for VSCode

File Templates Manager for VSCode allows you to manage your file templates and generate files from them.

Screen Cast

Features

File Template Manager is powerful extension with following features that improve your productivity and do routine work for you.

Manage file template

Explorer

Template Picker

Interactive integrated doT template engine

  • {{ }} - evaluation
  • {{= }} - interpolation
  • {{! }} - interpolation with encoding
  • {{# }} - compile-time evaluation/includes and partials
  • {{## #}} - compile-time defines
  • {{? }} - conditionals
  • {{~ }} - array iteration

Full Documentation of doT template engine


Variables available by default

  • DIR - directory of created file
  • NAME - name from input prompt
  • FILE - NAME + template extension
  • FILE_PATH - DIR + FILE
  • USER - name of user
  • DATE - date of file creation

Evaluation and interpolation example for HTML file

{{ for(let i = 0; i < 10; i++ ) }}
<div>Item {{=i}}</div>

result is

<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
<div>Item 5</div>
<div>Item 6</div>
<div>Item 7</div>
<div>Item 8</div>
<div>Item 9</div>

Select prompt example for C# language file

using System;

{{#def.select('TYPE', 'Select file type', ['class','interface','struct','enum'])}}
/*
  {{=$.NAME}} {{=$.TYPE}}
 */
public {{=$.TYPE}} {{=$.NAME}}
{

}

you will see a prompt

Select value

and get result for class type

using System;

/*
  CSharp class
 */
public class CSharp {

}

tsconfig.json example file

{{#def.select('MODULE', 'Specify module code generation', ['none','commonjs','amd','system','umd','es6','es2015','esnext'])}}
{{#def.select('TARGET', 'Specify ECMAScript target version', ['es3','es6','es2016','es2017','esnext'])}}
{{#def.confirm('SOURCE_MAP', 'Should generate corresponding .map file?')}}
{
  "compilerOptions": {
      "module": "{{=$.MODULE}}",
      "target": "{{=$.TARGET}}",
      "sourceMap": {{=$.SOURCE_MAP}}
  },
  "exclude": [
      "node_modules"
  ]
}

Extension Settings

This extension contributes the following settings:

  • templates.showExplorer: show/hide templates explorer
  • templates.customVars: you can define custom variables like AUTHOR, LICENSE, PROJECT and etc

file-templates-manager's People

Contributors

3axap4ehko avatar

Watchers

 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.