LoginSignup
4
4

More than 5 years have passed since last update.

Visual Studio 2015のGruntを使ってファイルをコピー

Last updated at Posted at 2015-10-05

TypeScriptのIDEとしてVisual Studioを使いたいが、GAEのアップロード等はEclipseのプラグインを使った方法が簡単。
そこで、Visual Studioで作成したjsファイルをGruntでEclipseのプロジェクト下にコピーする。
Visual Studio 2015からGruntが組み込まれ、利用が非常に簡単になった。
プロジェクトファイルと同階層にpackage.jsonとGruntfile.jsを作成する。

package.json
{
  "name": "AnimeInfoClient",
  "version": "0.0.0",
  "description": "AnimeInfoClient",
  "main": "Gruntfile.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/kumo2ji/AnimeInfoClient.git"
  },
  "author": "kumo2ji",
  "license": "BSD",
  "devDependencies": {
    "grunt": "~0.4.5",
    "grunt-contrib-copy": "~0.8.1"
  }
}

devDependenciesのバージョンは補完が効く。

Gruntfile.js
module.exports = function (grunt) {
    grunt.initConfig({
        copy: {
            main: {
                files: [
                    {
                        expand: true, src: ['*.js', 'index.html', '!Gruntfile.js'],
                        dest: '../AnimeInfoClient/war', filter: 'isFile'
                    }
                ]
            },
        },
    });
    grunt.loadNpmTasks('grunt-contrib-copy');
};

表示 > その他のウィンドウ > タスクランナーエクスプローラーでタスクランナーエクスプローラーを確認すると、copyタスクが追加されている。
タスクランナーエクスプローラー.PNG
copy:mainをダブルクリックすれば、必要なファイルのコピーが実行される。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4