Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.Net MVC4 bundle for less files not being rendered when debug set to false
    text
    copied!<p>In a simple ASP.Net MVC4 test application, I installed the dotless NuGet package and <a href="http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification" rel="noreferrer">followed this tutorial</a>. </p> <p>My <code>.less</code> files are being correctly parsed to CSS and work fine when <code>debug=true</code>.</p> <pre><code>&lt;link href="/Public/less/main.less" rel="stylesheet"/&gt; &lt;link href="/Public/less/home.less" rel="stylesheet"/&gt; &lt;link href="/Public/less/a.less" rel="stylesheet"/&gt; &lt;link href="/Public/less/b.less" rel="stylesheet"/&gt; &lt;link href="/Public/less/c.less" rel="stylesheet"/&gt; </code></pre> <p>However when I set <code>debug=false</code> in order to have it minify and combine to a single stylesheet, I get this:</p> <pre><code>&lt;link href="/Public/less?v=" rel="stylesheet"/&gt; // NOT WORKING! </code></pre> <p>Here's my bundle configuration file; again, taken directly from the tutorial:</p> <pre><code>public class BundleConfig { // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725 public static void RegisterBundles(BundleCollection bundles) { // Compile .less files and create a bundle for them. var lessBundle = new Bundle("~/Public/less").Include( "~/Public/less/main.less", "~/Public/less/home.less", "~/Public/less/a.less", "~/Public/less/b.less", "~/Public/less/c.less"); lessBundle.Transforms.Add(new LessTransform()); lessBundle.Transforms.Add(new CssMinify()); bundles.Add(lessBundle); } } </code></pre> <p>And in my Layout file:</p> <pre><code>&lt;head&gt; @Styles.Render("~/Public/less") &lt;/head&gt; </code></pre> <p>And here's my LessTransform class:</p> <pre><code>public class LessTransform : IBundleTransform { public void Process(BundleContext context, BundleResponse response) { response.Content = dotless.Core.Less.Parse(response.Content); response.ContentType = "text/css"; } } </code></pre> <hr> <p>Any ideas on why the bundle is not working properly on <code>debug=false</code>?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload