0

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)

Professor of programming
  • 2,643
  • 3
  • 22
  • 44
  • are you having your LESS files compiled in-browser using less.js? – Shameen Sep 22 '17 at 14:43
  • No, gulp is compiling Less via the `ProjectOpened` binding in Visual Studio 2017. – Professor of programming Sep 22 '17 at 14:50
  • Not the best idea, but you could pass variables into the LESS options in gulpfile.js (`globalVars`), however you would need to get the base url into gulp instead. Maybe this could do that? https://stackoverflow.com/questions/28538918/pass-parameter-to-gulp-task – Shameen Sep 22 '17 at 20:50
  • Visual Studio 2017 constructs the commands so I have no control over them as far as I'm aware, I might consider raising this with MS to see what they propose. This isn't a problem on the command line as the solution you mentioned will work but I was hoping for something that would work on development machines and build machines. – Professor of programming Sep 23 '17 at 13:28
  • They are different questions, both asked by myself, even though the solution is the same. – Professor of programming Nov 15 '17 at 10:29

1 Answers1

0

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

Professor of programming
  • 2,643
  • 3
  • 22
  • 44