grunt で監視して typescriptを自動コンパイル

https://www.npmjs.com/package/grunt-typescript

$ npm install grunt-typescript –save

referenceも各ファイルに書かずに済んで良い感じです

Gruntfiles.js
module.exports = function(grunt) {
grunt.initConfig({
cssmin: {
minify: {
files: {
}
}
},
typescript: {
base: {
src: ['src/typescript/**/*.ts'],
dest: 'src/javascript',
options: {
module: 'commonjs',
target: 'es5',
basePath: 'src/typescript',
references: [
'typings/tsd.d.ts'
],
watch: 'src/typescript'
}
}
}
}
grunt.loadNpmTasks('grunt-typescript');
};

監視開始
$ grunt typescript
Running "typescript:base" (typescript) task

Watching... src/typescript
change src/typescript/routes/index.ts
1 file created. js: 1 file, map: 0 files, declaration: 0 files (1795ms)

ファイルが出来ました。
$ tree src/typescript/
src/typescript/
└── routes
└── index.ts

$ tree src/javascript/
src/javascript/
└── routes
└── index.js

This entry was posted on 月曜日, 3月 16th, 2015 at 9:46 AM and is filed under Javascript, node.js, Typescript. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。