My goal is to minify JS files using NPM commands, but I want the minify command to only run after Post Publish and not on Build. Unfortunately, it currently runs after both build and publish. In my Package.json file, I have the following code:
"scripts": {
"uglify": "recursive-uglifyjs ./Scripts/src/"
}
I have added a new DefaultTarget in my .csproj file:
<Project ToolsVersion="12.0" DefaultTargets="Build;AfterPublish"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
And here is the code for the target:
<Target Name="AfterPublish" AfterTargets="MSDeployPublish">
<Exec Command="npm run uglify " />
<Exec Command="echo $(Configuration)"></Exec>
<Exec Command="echo testing..after publiosh " />
Unfortunately, when running this, it minifies the JS files after both build and publish. What I actually need is for it to only happen after publishing.
If you have any suggestions or see where I might be going wrong, please let me know!