selanac82
selanac82

Reputation: 3000

Trying to use the CSSMinify class in .NET

Does anyone know how to use the .net cssminify class?

http://msdn.microsoft.com/en-us/library/hh195101.aspx

Microsofts documentation is terrible (as with anything microsoft) and i tried googling example but can't find any. Has anyone every implemented this and can show some examples of how to do so? thanks in advance.

Upvotes: 2

Views: 1044

Answers (1)

hutchonoid
hutchonoid

Reputation: 33306

If it is CSS minification you're after just use Mvc's built in bundling.

Here is a link with a tutorial:

http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification

You just need to add this and by default it will be minified.

bundles.Add(
new StyleBundle("~/Content/Bundle").Include(
"~/Content/CSS/your.css"));

Update

As mentioned by @selanac82, you could also add the below as a transform.

cssbundle.Transform.Add(new CssMinify());

Upvotes: 2

Related Questions