I am using the BETA2 ASP.NET Bundling & Optimization....System.Web.Optimization
I am attempting to bundle "Less" style sheets....as outlined in the excellent article.... http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification
If I have an "@import" command at the beginning of two Less files (because they share variables) ....this recommended implementation will not work.....I get a runtime exception that says the file specified in the @import command cannot be found. I have
tried specifying the file with an absolute path as well as simply the file name.
Any ideas on how I can adjust the recommended Less file implementation so Less files will work ?
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
plippard
Member
60 Points
58 Posts
ASP.NET Bundling & Optimization - Less File Bundling
Jul 31, 2012 03:04 AM|LINK
I am using the BETA2 ASP.NET Bundling & Optimization....System.Web.Optimization
I am attempting to bundle "Less" style sheets....as outlined in the excellent article.... http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification
If I have an "@import" command at the beginning of two Less files (because they share variables) ....this recommended implementation will not work.....I get a runtime exception that says the file specified in the @import command cannot be found. I have tried specifying the file with an absolute path as well as simply the file name.
Any ideas on how I can adjust the recommended Less file implementation so Less files will work ?
imran_ku07
All-Star
45864 Points
7713 Posts
MVP
Re: ASP.NET Bundling & Optimization - Less File Bundling
Aug 06, 2012 05:26 AM|LINK
Just update your Less transform as given here,
public class LessTransform : IBundleTransform { public void Process(BundleContext context, BundleResponse response) { var oldPath = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(Server.MapPath("~")); response.Content = dotless.Core.Less.Parse(response.Content); Directory.SetCurrentDirectory(oldPath); response.ContentType = "text/css"; } }More information at here.
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
plippard
Member
60 Points
58 Posts
Re: ASP.NET Bundling & Optimization - Less File Bundling
Aug 06, 2012 02:53 PM|LINK
https://bitbucket.org/mrcode/bundlingsandbox
I found this code on the Internet which provides a more comprehensive solution.