Although there are several articles on this issue, I can't seem to find any that are recent and apply to ASPNET Core 2.x, Visual Studio 2017.
How do I only publish my minified versions of JavaScript (.js) files?
It would be nice to do this via the publish profile (.pubxml) so that I can include/exclude by setting up different publish profiles (Dev, UAT, Staging, Production.
Just exclude all .css/.js files and then include .min files. The last rule overrides the previous.
<ItemGroup>
<Content Update="wwwroot\**\*.css" CopyToPublishDirectory="never" />
<Content Update="wwwroot\**\*.min.css" CopyToPublishDirectory="always" />
<Content Update="wwwroot\**\*.js" CopyToPublishDirectory="never" />
<Content Update="wwwroot\**\*.min.js" CopyToPublishDirectory="always" />
</ItemGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With