This project has moved. For the latest updates, please go here.

Less failure on Production Server

Jan 15, 2013 at 6:23 PM

Hi,

Sorry to ask a deployment question but I am hoping someone has a hint to help me find my configuration issue.   I am trying to use Less in MVC 4.  I am using the latest nuget packages.  

I have a bundle like this in my BundleConfig.cs file.  

 var fs = new StyleBundle("~/bundles/foundation/css").Include(
                       "~/Content/foundation/foundation.css",
                       "~/Content/foundation/app.less");
 fs.Transforms.Add(cssTransformer);
 fs.Orderer = new NullOrderer();
 //not using until figure out transform issues fs.Transforms.Add(new CssMinify());
 bundles.Add(fs);

I have the config sections of the web config setup like the example project except my less section is of type BundleTransformer.Less.Configuration.LessSettings instead of BundleTransformer.LessLite.Configuration.LessLiteSettings (because I only have less transformer installed).  I am using only core and less sections.

I have tested locally with optimization on and off.  Both work fine.  

So on my production server with optimization on and off it fails.  With optimization off the foundation.css file is listed but the app.less isn't listed in the html page output.  If optimization is on the final css output file doesn't have any content from the app.less file.  

 

Any ideas of where I can look for logs or information or config settings that are incorrect?  

 

Thanks for any help. 

Sean

 

 

 

 

Jan 15, 2013 at 6:31 PM

Sorry.  After hours of searching I didn't find anything and then 5 minutes after posting the question I figured it out.  My app.less file was not marked as "Content" in visual studio so it wasn't getting published (The generated css and min.css files were so it wasn't obvious at first glance when looking at server file system).  

Sorry for the stupid error and question.  :)  

Thanks for all your work on this project I really appreciate how easy it is to use LESS within MVC projects because of the transformers and nuget packages.  

Coordinator
Jan 16, 2013 at 11:17 AM

Hello, Spbrogan!

In the code there is one problem: Bundle Transformer cannot be used together with classes StyleBundle and ScriptBundle, because these classes already contain transformations (instances of the built-in minifiers: CssMinify and JsMinify). In case, if the use of Bundle Transformer minifier-adapters (BundleTransformer.MicrosoftAjax, BundleTransformer.Yui, BundleTransformer.Closure, BundleTransformer.JsMin, BundleTransformer.UglifyJs, BundleTransformer.Packer, BundleTransformer.Csso and BundleTransformer.WG), it may cause the double minification of code and lead to errors. Therefore Bundle Transformer should be used only together with the Bundle class, as shown in the examples.

Mar 23, 2013 at 8:48 AM
spbrogan wrote:
Sorry.  After hours of searching I didn't find anything and then 5 minutes after posting the question I figured it out.  My app.less file was not marked as "Content" in visual studio so it wasn't getting published (The generated css and min.css files were so it wasn't obvious at first glance when looking at server file system).   Sorry for the stupid error and question.  :)   Thanks for all your work on this project I really appreciate how easy it is to use LESS within MVC projects because of the transformers and nuget packages.  
Thank you very much. Two days I was working on this as you said stupid issue. I have same issue and solves with your reply.