Publish Gulp Files Using Visual Studio 2015

In the new Visual Studio 2015 and the Web Essentials plugin, they removed this feature to compile specific files, such as Smaller Files. Instead, they suggest using Gulp tasks.

While I welcome this decision and understand how to configure Gulp to compile Less files, but since it is not an ASP.NET 5 application, new files are not automatically added to the project and, as such, do not get copied when using the VS2015 publish function.

As I see it, the only way to make this file copy is to manually add them to the project. It seems unlawful intuitive if you create a task to compile ** / *. You need to search the entire project to find the generated css files and add them all manually.

Am I just doing something wrong or is it the way it works now?

+5
source share
2 answers

Do not add files manually, it is quite easy to add them with a goal to the project file. This is how we do it, and we also use the gulp -rev package, which dynamically changes our file name (therefore, they will not be cached by the browser). This is how our BeforeBuild target from our .csproj file looks like this:

<Target Name="BeforeBuild"> <Exec Command="BeforeBuild.bat" WorkingDirectory="$(ProjectDir)" /> <ItemGroup> <Content Include="Scripts\Output\**\*.js" /> <Content Include="Content\**\output\**\*.css" /> </ItemGroup> </Target> 

And in our case, when we publish all the js files created from Scripts \ Output \ all_folders \, they will be published even if they are not in csproj (and the same for the generated css files)

+5
source

For those who prefer the Web Essentials method to compile Less, Sass, and CoffeeScript files, Mads Kristensen has published a new VS 2015 extension called Web Compiler . Give it a try. Also see the Bundler and Minifier Extension for additional functionality removed from Web Essentials.

+1
source

All Articles