Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Web Compiler" compile on save not working

I am using web compiler but it will not compile my SASS structure unless I right-click on "compilerconfig.json" and select "Web-compiler" --> "Re-compile all files".

When I use the other methods to trigger compile...

  • When I save a SCSS-file (most important)
  • When I go to menu "Build" --> "Re-compile all files in solution"
  • When I use the short command Shift + Alt + Y

It will tell me "Compiled successfully" or "Done compiling", however files are not updated.

I am using Visual Studio 2015 v.3 and Web Compiler UPDATED 8/2/2016, VERSION 1.11.319.

like image 660
Jesper Wilfing Avatar asked Sep 02 '16 08:09

Jesper Wilfing


2 Answers

Found the answer in a forum. I just needed to remove some temp files and restart Visual Studio:

%localappdata%\temp\WebCompiler1.xx

Forum post: https://github.com/madskristensen/WebCompiler/issues/158

Hope this helps someone!

like image 51
Jesper Wilfing Avatar answered Nov 12 '22 15:11

Jesper Wilfing


Sadly, the solution offered here did not work. Seems I'm not alone in this.

In case it helps anyone else, I found another workaround, which seems to offer an extra side benefit.

If you add a Razor view to your project (I named it JsHelper.cshtml and added it in \Views\Shared) and use the following for the contents (extra line breaks added to make it fit in the SO width)...

@model string
@{
  string ext = HttpContext.Current != null
               && HttpContext.Current.Request.Url.Host.Contains("localhost")
    ? ""
    : ".es5.min";
}
<script src="/Scripts/@Model@(ext).js" type="text/javascript"></script>

...then instead of adding script tags like this...

<script src="/Scripts/General.es5.min.js" type="text/javascript"></script>

...you can add this...

@Html.Partial("~/Views/Shared/JsHelper.cshtml", "General")

When you are running the web site in Visual Studio, the uncompiled version of the Javascript file will be used. When running anywhere else (eg on the production server), the .es5.min.js version will be used.

As publishing a web project involves building it, which will compile the .js files, you can be confident that the compiled and minified files that are published are up-to-date.

This has the side-benefit that when debugging your scripts in the browser, you have access to the full version of the .js file, instead of the compiled and minified version that you would get if you referenced them directly. As another breaking change that occurred in the latest version of Web Compiler is that they no longer produce .map.js files when compiling, this is a huge side benefit.

Hope this helps.

like image 1
Avrohom Yisroel Avatar answered Nov 12 '22 16:11

Avrohom Yisroel