Reputation: 2391
Here are standard bindings in Task Runner in Visual Studio 2019 (Before build, After build, Clean, Project open).
I configured scripts for Webpack in package.json
file (dev, prod etc.). Everything works well during development.
What i need is to execute my configured Webpack script to produce minified js/css files before pubish and then publish my ASP.NET Core project (with minified versions of that files).
I can not figure out how to connect Task Runner with publish profile (*.pubxml) and Webpack script.
Upvotes: 0
Views: 739
Reputation: 2391
I found a solution for my problem. I added new Target
in my Properties -> PublishProfiles -> _name_.pubxml
file:
...
<Target Name="PrePublish" BeforeTargets="Build">
<Exec Command="webpack --mode production"/>
</Target>
...
This Webpack command executes before build and before publish, so brand new minified files are picked up and published.
Upvotes: 2