Skip to content

A WeApp project template in TypeScript using VS Code

License

Notifications You must be signed in to change notification settings

alfadb/we-app-typescript

 
 

Repository files navigation

WeApp TypeScript

A WeApp project template in TypeScript using VS Code
VS Code下基于TypeScript的微信小程序项目模板

About / 关于

This is a WeApp project template using TypeScript where async/await can be used freely even targetting ES5
使用TypeScript的微信小程序项目模板 可以在目标ES5的时候随意地使用async/await

Usage / 使用

  • There are some node module dependencies should be installed globally or locally:
  • 全局或本地安装下列Node依赖模块:
Node Module Command
TypeScript>2.1.4 npm install -g typescript
Typings npm install -g typings
TSLint npm install -g tslint
Gulp npm install -g gulp
  • After installing those modules run the command of npm install and typings install to install dev dependencies and typings dependencies then the project can be built by the command gulp which runs the default task in gulpfile.js

  • 安装完以上模块后 使用命令npm installtypings install来安装开发依赖模块和Typings依赖 然后就可以通过gulp命令编译整个项目

  • These VS Code extensions is recommeded to be installed:

  • 推荐安装下列VS Code插件:

  • All files are built into a dist folder so it is the dist folder which will be referenced in Wexin dev tool for a WeApp instead of the project folder or the folder of src

  • 所有文件都被编译到 dist 文件夹下 所以在微信开发者工具中应该引用 dist 文件夹 而不是 项目文件夹 或者 src文件夹

async/await

  • async/await can be used freely when targetting ES5 with the ES6-promise polyfill imported
  • 引用ES6-promise polyfill后可以在指向ES5时随意地使用async/await
  • The sample code about async/await can be found in app.ts and http-client.ts
  • async/await相关的示例代码在app.tshttp-client.ts文件中
  • The first commented line should be reserved to import the ES6-promise polyfill after TypeScript compilation and this line of code shoud be added with adjusting the relative path of es6-promise.min.js to the file where async/await is used
  • 文件中的第一行注释是用来在TypeScript编译之后引入ES6-promise polyfill的 所以应该被保留 并且 所有用到async/await的文件都应该在调整es6-promise.min.js文件的相对路径后添加这行代码
// var Promise = require('./utils/es6-promise.min').Promise;

Last Update

2016.12.12

About

A WeApp project template in TypeScript using VS Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 70.5%
  • JavaScript 29.5%