Search code examples
.netgulpless

How can I add support for .NET web application virtual paths in gulp?


I am using gulp with a .NET Core web application and I have a Less file that contains paths to physical files like so:

background: @colour-background-darkest-base url(/content/slides/experience.jpg) no-repeat center top fixed;

But when I run the web application in a virtual path the image can't be found. How can I provide support for virtual paths so that I can do the following:

background: @colour-background-darkest-base url(~/content/slides/experience.jpg) no-repeat center top fixed;

(Note the ~ at the start of the path)


Solution

  • This question has been answered in the following SO question: Use Bower package version numbers in Razor views for CDN support

    In a nutshell, combine gulp with Bundling and Minification with ASP.Net MVC