I am trying to minify JS files using NPM commands. I need minify command must run only on Post Publish and not on Build. But currently it runs after build and publish both. I have written the following code in Package.json:
"scripts": {
"uglify": "recursive-uglifyjs ./Scripts/src/"
}
I have created a new DefaultTarget in .csproj
<Project ToolsVersion="12.0" DefaultTargets="Build;AfterPublish"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
And code for target is:
<Target Name="AfterPublish" AfterTargets="MSDeployPublish">
<Exec Command="npm run uglify " />
<Exec Command="echo $(Configuration)"></Exec>
<Exec Command="echo testing..after publiosh " />
Whenever I run this. It minify JS files after build and publish both. Where as I need to restrict it to Publish only.
Please let me know if I am missing something.