2

I would like to compile only the changed typescript files with grunt-ts (otherwise it would be extremely slow), but it seems that I cannot.

  • I was trying to start it as a concurrent task, but in this case it seems that my normal watch is not working.
  • Also tried to use watch for it, but in that case it is compiling all the files.

The only way I succeeded is to start the grunt-ts as a separate grunt process. This way it is really compiling just the changed files, but I need to start it separately

So obviously I would like to run just one grunt.

Any suggestion how I can accomplish it?

UPDATE:

What is strange, that today I changed my setting and it is working kind of well.

I have reference file for completion (above the app folder) and navigation and also my file is compiling fast enough.

Not sure how it is doing it as compile is set up as false for ts:dev (it is just for maintaining my reference file).

Also I stopped grunt to try whether something else is running. But the js files were not refreshed, so nothing else is compiling them.

Strange but it is working now as I wanted to have it. (not sure though why grunt-ts is compiling the file if I have false as default, but ...)

My config is:

ts: {
    options: {
        compile: false,
        comments: false,
        target: 'es5',
        module: 'amd',
        sourceMap: true,
        sourceRoot: '',
        mapRoot: '',
        declaration: false,
        noImplicitAny: false,
        fast: 'never'
    },
    initDev: {
        src: [
            '<%= yeoman.app %>/**/*.ts'
        ],
        reference: '_references.ts',
        options: {
            compile: true
        }
    },
    dev: {
        src: [
            '<%= yeoman.app %>/**/*.ts'
        ],
        reference: '_references.ts'
    }
}

...

watch: {
    ts: {
        files: '<%= yeoman.app %>/**/*.ts',
        tasks: ['ts:dev']
    }
}

I am starting the ts:initDev when grunt starts and and running ts:dev when files changing.

UPDATE 2:

Sorry it seems that something else is compiling the files. I have set up tsc to compile in the editor setting. Which is ok.

eesdil
  • 1,931
  • 3
  • 16
  • 25
  • Your configuration would be helpful. Also feel free to log an issue : https://github.com/TypeStrong/grunt-ts/issues – basarat Dec 11 '14 at 22:44
  • it looks like that strangely I was able to set up as I wanted, still don't understand how... anyway thank you – eesdil Dec 12 '14 at 09:54
  • I have posted an issue on github. Otherwise now it is working fine using grunt-ts for initial compilation and maintaining the reference file. thanks a lot – eesdil Dec 12 '14 at 11:24

1 Answers1

0

I personally use the typescript watcher itself. I use also (disclaimer, I wrote it) fast-live-reload to do other things, like syncing the folders, compass runs, etc.

bogdan.mustiata
  • 1,725
  • 17
  • 26