TypeStrong / grunt-ts

A grunt task to manage your complete typescript development to production workflow
https://www.npmjs.com/package/grunt-ts
MIT License
330 stars 122 forks source link

HTML change should only compile changed file #131

Open Psvensso opened 10 years ago

Psvensso commented 10 years ago

Hey guys, just wanted to open this issue to check if it´s a feature/bug or just expected behavior.

I was using grunt-contrib-watch to watch and compile (i have multiple steps so used the contrib watch instead of buildt in). Once i changed a HTML file i could see from the contrib-watch verbose logging that all my HTML partials was being triggered for change. Meaning that grunt-ts recompiles all HTML partials on each trip not just the ones being changed.

I can confirm this by filestructures changed time that all partials have been re-created.

This seems like a terrible waste, i can have a go at a pull request but wanted to run it through here first and see what you guys think.

basarat commented 10 years ago

just wanted to open this issue to check if it´s a feature/bug or just expected behavior.

:bug:

Just because I didn't know better when I started (didn't have a watch fast compile pipeline initially) and haven't used HTML templates for quite a while (moved to angular template cache).

Same issues existed for things I did use e.g. reference.ts and transformers so they got patched. e.g.

https://github.com/grunt-ts/grunt-ts/blob/93e55e51f3675270a6d34818f150e42fd6475ea7/tasks/modules/reference.ts#L101-L104

    // Modify the orig contents to put in our contents only if changed
    // Also Return whether the file was changed
    if (updatedFileContents !== referenceContents) {
        grunt.file.write(referenceFile, updatedFileContents);
        return true;
    }

And https://github.com/grunt-ts/grunt-ts/blob/b633f95295ddf22b28dfb8acd9c23c7bdb44df72/tasks/modules/transformers.ts#L298-L301

        var transformedContent = outputLines.join(os.EOL);
        if (transformedContent !== contents) {
            grunt.file.write(fileToProcess, transformedContent);
        }

i can have a go at a pull request

Whenever you have time :+1: