<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Dynamic Dot Less Css With Asp.net MVC 2</title>
	<atom:link href="http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/</link>
	<description>All Things .Net and Me</description>
	<lastBuildDate>Wed, 14 Dec 2011 23:12:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: .LESS &#8211; dynamic stylesheets for .NET Developer &#124; Code-Inside Blog International</title>
		<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/comment-page-1/#comment-422</link>
		<dc:creator>.LESS &#8211; dynamic stylesheets for .NET Developer &#124; Code-Inside Blog International</dc:creator>
		<pubDate>Sun, 31 Jul 2011 23:08:03 +0000</pubDate>
		<guid isPermaLink="false">http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/#comment-422</guid>
		<description>[...] On this library we are able to start the transformation from the code. How this could look like you will see if you read this nice description (even if it’s a little bit old) Dynamic Dot Less CSS With Asp.net MVC 2. [...]</description>
		<content:encoded><![CDATA[<p>[...] On this library we are able to start the transformation from the code. How this could look like you will see if you read this nice description (even if it’s a little bit old) Dynamic Dot Less CSS With Asp.net MVC 2. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: .LESS &#8211; dynamic stylesheets for .NWT Developer &#124; Code-Inside Blog International</title>
		<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/comment-page-1/#comment-421</link>
		<dc:creator>.LESS &#8211; dynamic stylesheets for .NWT Developer &#124; Code-Inside Blog International</dc:creator>
		<pubDate>Sun, 31 Jul 2011 10:59:14 +0000</pubDate>
		<guid isPermaLink="false">http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/#comment-421</guid>
		<description>[...] On this library we are able to start the transformation from the code. How this could look like you will see if you read this nice description (even if it’s a little bit old) Dynamic Dot Less CSS With Asp.net MVC 2. [...]</description>
		<content:encoded><![CDATA[<p>[...] On this library we are able to start the transformation from the code. How this could look like you will see if you read this nice description (even if it’s a little bit old) Dynamic Dot Less CSS With Asp.net MVC 2. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: .LESS&#8211;dynamische Stylesheets f&#252;r .NET Entwickler &#124; Code-Inside Blog</title>
		<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/comment-page-1/#comment-413</link>
		<dc:creator>.LESS&#8211;dynamische Stylesheets f&#252;r .NET Entwickler &#124; Code-Inside Blog</dc:creator>
		<pubDate>Tue, 28 Jun 2011 22:47:32 +0000</pubDate>
		<guid isPermaLink="false">http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/#comment-413</guid>
		<description>[...] Über diese Bibliothek können wir auch vom Code heraus die Transformation starten. Wie das genau aussehen kann wird hier recht gut beschrieben (auch wenn es schon etwas älter ist) : Dynamic Dot Less Css With Asp.net MVC 2 [...]</description>
		<content:encoded><![CDATA[<p>[...] Über diese Bibliothek können wir auch vom Code heraus die Transformation starten. Wie das genau aussehen kann wird hier recht gut beschrieben (auch wenn es schon etwas älter ist) : Dynamic Dot Less Css With Asp.net MVC 2 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Szymon Sasin</title>
		<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/comment-page-1/#comment-285</link>
		<dc:creator>Szymon Sasin</dc:creator>
		<pubDate>Tue, 07 Dec 2010 23:04:40 +0000</pubDate>
		<guid isPermaLink="false">http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/#comment-285</guid>
		<description>Hi,

instea creatning custom ViewEngine why not use existing facility? 

&lt;code&gt;
public static class LessCssHelper
{
	static LessCssHelper()
	{
		_fileFormats = new[] {
			&quot;~/Content/Stylesheets/{0}.less&quot;,
			&quot;~/Stylesheets/{0}.less&quot;
		};
	}
	public static string Generate(string fileName, bool minify)
	{
		var lessEngine = new EngineFactory();
		lessEngine.Configuration.MinifyOutput = minify;
		var output =
			lessEngine
				.GetEngine()
				.TransformToCss(GetFile(fileName), null);
		return output;
	}

	private static string GetFile(string fileName)
	{
		var result = string.Empty;
		var pathProvider = HostingEnvironment.VirtualPathProvider;

		foreach (var format in _fileFormats)
		{
			var nameWithExtension = String.Format(format, fileName);
			if (pathProvider.FileExists(nameWithExtension))
			{
				var file = pathProvider.GetFile(nameWithExtension);
				using (var stream = new StreamReader(file.Open()))
				{
					result += stream.ReadToEnd();
				}
				break;
			}
		}

		return result;
	}

	private static string[] _fileFormats;
}
&lt;/code&gt;

All you have to do is to pass a file name requested. 

Second thing is to keep a MC style ( so without .less extension)

Regards,
Szymon</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>instea creatning custom ViewEngine why not use existing facility? </p>
<p><code><br />
public static class LessCssHelper<br />
{<br />
	static LessCssHelper()<br />
	{<br />
		_fileFormats = new[] {<br />
			"~/Content/Stylesheets/{0}.less",<br />
			"~/Stylesheets/{0}.less"<br />
		};<br />
	}<br />
	public static string Generate(string fileName, bool minify)<br />
	{<br />
		var lessEngine = new EngineFactory();<br />
		lessEngine.Configuration.MinifyOutput = minify;<br />
		var output =<br />
			lessEngine<br />
				.GetEngine()<br />
				.TransformToCss(GetFile(fileName), null);<br />
		return output;<br />
	}</p>
<p>	private static string GetFile(string fileName)<br />
	{<br />
		var result = string.Empty;<br />
		var pathProvider = HostingEnvironment.VirtualPathProvider;</p>
<p>		foreach (var format in _fileFormats)<br />
		{<br />
			var nameWithExtension = String.Format(format, fileName);<br />
			if (pathProvider.FileExists(nameWithExtension))<br />
			{<br />
				var file = pathProvider.GetFile(nameWithExtension);<br />
				using (var stream = new StreamReader(file.Open()))<br />
				{<br />
					result += stream.ReadToEnd();<br />
				}<br />
				break;<br />
			}<br />
		}</p>
<p>		return result;<br />
	}</p>
<p>	private static string[] _fileFormats;<br />
}<br />
</code></p>
<p>All you have to do is to pass a file name requested. </p>
<p>Second thing is to keep a MC style ( so without .less extension)</p>
<p>Regards,<br />
Szymon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gustavo Machado</title>
		<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/comment-page-1/#comment-274</link>
		<dc:creator>Gustavo Machado</dc:creator>
		<pubDate>Tue, 28 Sep 2010 20:11:22 +0000</pubDate>
		<guid isPermaLink="false">http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/#comment-274</guid>
		<description>This is brillant mate!</description>
		<content:encoded><![CDATA[<p>This is brillant mate!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan</title>
		<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/comment-page-1/#comment-273</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Tue, 21 Sep 2010 19:16:20 +0000</pubDate>
		<guid isPermaLink="false">http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/#comment-273</guid>
		<description>Nice walkthrough and a clever approach, but like some of the other commenters I also think that involving the ViewEngine may be an unnecessary step. Returning a custom ActionResult is more in-line with the intended model in MVC.</description>
		<content:encoded><![CDATA[<p>Nice walkthrough and a clever approach, but like some of the other commenters I also think that involving the ViewEngine may be an unnecessary step. Returning a custom ActionResult is more in-line with the intended model in MVC.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ASP.NET MVC Archived Blog Posts, Page 1</title>
		<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/comment-page-1/#comment-249</link>
		<dc:creator>ASP.NET MVC Archived Blog Posts, Page 1</dc:creator>
		<pubDate>Tue, 06 Jul 2010 04:32:10 +0000</pubDate>
		<guid isPermaLink="false">http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/#comment-249</guid>
		<description>[...] to VoteDynamic Dot Less Css With Asp.net MVC 2 &#124; Schotime.net (7/1/2010)Thursday, July 01, 2010 from SchotimeI have been having a look at the best way to theme a asp.net [...]</description>
		<content:encoded><![CDATA[<p>[...] to VoteDynamic Dot Less Css With Asp.net MVC 2 | Schotime.net (7/1/2010)Thursday, July 01, 2010 from SchotimeI have been having a look at the best way to theme a asp.net [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Schotime</title>
		<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/comment-page-1/#comment-246</link>
		<dc:creator>Schotime</dc:creator>
		<pubDate>Fri, 02 Jul 2010 00:08:56 +0000</pubDate>
		<guid isPermaLink="false">http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/#comment-246</guid>
		<description>You are indeed correct about the extension method. That is a better way to do it.

I did see the variables you can pass into the query string. If I was to use that I think I would still run it through a controller as its easy to gather the resources needed to pass to the style sheet in the controller rather than in the master page using a action filter or something.

Is there a way to pass a list of key value pairs to the parser to be processed with the less file?</description>
		<content:encoded><![CDATA[<p>You are indeed correct about the extension method. That is a better way to do it.</p>
<p>I did see the variables you can pass into the query string. If I was to use that I think I would still run it through a controller as its easy to gather the resources needed to pass to the style sheet in the controller rather than in the master page using a action filter or something.</p>
<p>Is there a way to pass a list of key value pairs to the parser to be processed with the less file?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dynamic Dot Less Css With Asp.net MVC 2 &#124; Schotime.net&#160;&#124;&#160;My Blog</title>
		<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/comment-page-1/#comment-245</link>
		<dc:creator>Dynamic Dot Less Css With Asp.net MVC 2 &#124; Schotime.net&#160;&#124;&#160;My Blog</dc:creator>
		<pubDate>Thu, 01 Jul 2010 16:12:49 +0000</pubDate>
		<guid isPermaLink="false">http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/#comment-245</guid>
		<description>[...] here: Dynamic Dot Less Css With Asp.net MVC 2 &#124; Schotime.net    This entry was posted on Thursday, July 1st, 2010 at 2:33 pm and is filed under Uncategorized. [...]</description>
		<content:encoded><![CDATA[<p>[...] here: Dynamic Dot Less Css With Asp.net MVC 2 | Schotime.net    This entry was posted on Thursday, July 1st, 2010 at 2:33 pm and is filed under Uncategorized. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tgmdbm</title>
		<link>http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/comment-page-1/#comment-243</link>
		<dc:creator>tgmdbm</dc:creator>
		<pubDate>Thu, 01 Jul 2010 15:10:03 +0000</pubDate>
		<guid isPermaLink="false">http://schotime.net/blog/index.php/2010/07/02/dynamic-dot-less-css-with-asp-net-mvc-2/#comment-243</guid>
		<description>Nice.

To be more in keeping with MVC this would be better implemented as an ActionResult and an extension method on Controller.

&lt;code&gt;return Less(filename, model);&lt;/code&gt;

also be aware that you can pass variables to the less parser by including them on the query string. you might not need to run it through the whole WebForms engine

&lt;code&gt;&lt;link href=&quot;/public/css/sites.less?basecolor=#aabbcc&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Nice.</p>
<p>To be more in keeping with MVC this would be better implemented as an ActionResult and an extension method on Controller.</p>
<p><code>return Less(filename, model);</code></p>
<p>also be aware that you can pass variables to the less parser by including them on the query string. you might not need to run it through the whole WebForms engine</p>
<p><code>&lt;link href="/public/css/sites.less?basecolor=#aabbcc" rel="stylesheet" type="text/css" /&gt;</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

