Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing Gulp task(s) only when publishing ASP.NET 5 web application

What would be the best way to execute Gulp tasks only when publishing an ASP.NET 5 web application? Do I need to add a custom build event that executes a Gulp command?

cmd.exe /c gulp -b "C:\Projects\ProjectName\Source\ProjectName.Web" --gulpfile "C:\Projects\ProjectName\Source\ProjectName.Web\Gulpfile.js" publish

Or, preferably, is there a way to bind a Gulp task to the BeforePublish target via the Task Runner Explorer?

Any suggestions would be very appreciated.

like image 704
Jonathan Freeland Avatar asked Aug 07 '15 17:08

Jonathan Freeland


1 Answers

UPDATE 2 .NET Core CLI doesn't support "prepack" any more. A "postcompile" script may work better.

https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json#scripts

Original Answer

Add it to your "scripts" section of project.json

project.json: Scripts documentation

{
...
  "scripts": {
    "prepack": "gulp publish",
  }
...
}
like image 162
natemcmaster Avatar answered Oct 17 '22 16:10

natemcmaster