Skip to content

Add an option for compile-on-save to trigger VS pre- and post-build events #2252

Closed

Description

@rotemdan

I have a TS project that's compiled to a single file, where I need to append some additional code to the resulting combined file. I added a VS post-build action to perform the processing every time I build the solution. It works fine when Build -> Build Solution (F6) or Build -> Rebuild Solution are used, but not following a compile-on-save, leading to the resulting .js file missing the expected additional code.

My current workaround is using a Grunt script that monitors the compiled .js file for changes and executes whenever it's modified. This might work fine for post-build actions in most cases (except perhaps in situations requiring tight VS synchronization with build start/completion) but doesn't support pre-build actions and generally isn't very elegant as it requires maintaining an additional background process.

It would be useful to have an option (which may or may not be enabled by default) to trigger the pre- and post-build events with this compilation method as well.

This (optional) behavior could be extended to other compiled-on-save languages such as LESS, SASS, Coffeescript etc. (though in these cases it's probably more of a Web Essentials suggestion).

Activity

  1. changed the title [-]Add an option for compile-on-save to invoke VS pre- and post-build events[/-] [+]Add an option for compile-on-save to trigger VS pre- and post-build events[/+] on Mar 7, 2015
  2. mhegazy commented on Dec 9, 2015

    @mhegazy
    Contributor

    Your current workaround would be my recommendation here. Using the a build tool like grunt or gulp and/or watcher should achieve the described scenario. The other option is to use the single file generator. this gives the maximum flexibility and allows for different ways of composing the events that should occur on save.

  3. added
    DeclinedThe issue was declined as something which matches the TypeScript vision
    Out of ScopeThis idea sits outside of the TypeScript language design constraints
    on Dec 9, 2015
  4. locked and limited conversation to collaborators on Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedThe issue was declined as something which matches the TypeScript visionOut of ScopeThis idea sits outside of the TypeScript language design constraintsSuggestionAn idea for TypeScriptVisual StudioIntegration with Visual Studio

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions