Skip to content

Instantly share code, notes, and snippets.

@smockle
Forked from andrewbranch/BundleConfig.cs
Last active December 22, 2015 22:59
Show Gist options
  • Save smockle/6544205 to your computer and use it in GitHub Desktop.
Save smockle/6544205 to your computer and use it in GitHub Desktop.
using System.Web;
using System.Web.Optimization;
using BundleTransformer.Core.Transformers;
namespace Project {
public class BundleConfig {
public static void RegisterBundles(BundleCollection bundles) {
var styles = new Bundle("~/bundles/stylesheets")
.Include("~/Assets/stylesheets/*.css")
.Include("~/Assets/stylesheets/*.less");
styles.Transforms.Add(new CssTransformer());
bundles.Add(new ScriptBundle("~/bundles/javascripts").IncludeDirectory("~/Assets/javascripts/plugins", "*.js").IncludeDirectory("~/Assets/javascripts", "*.js"));
bundles.Add(styles);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace Project {
public class MvcApplication : System.Web.HttpApplication {
protected void Application_Start() {
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
<%= Styles.Render("~/bundles/stylesheets") %>
<%= Scripts.Render("~/bundles/javascripts") %>
<configuration>
<bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
<core>
<css>
<minifiers>
<add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
</minifiers>
<translators>
<add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
<add name="LessTranslator" type="BundleTransformer.Less.Translators.LessTranslator, BundleTransformer.Less" /></translators>
</css>
<js>
<minifiers>
<add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
</minifiers>
<translators>
<add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
</translators>
</js>
</core>
<less>
<jsEngine name="V8JsEngine" />
</less>
</bundleTransformer>
<jsEngineSwitcher xmlns="http://tempuri.org/JavaScriptEngineSwitcher.Configuration.xsd">
<core>
<engines>
<add name="V8JsEngine" type="JavaScriptEngineSwitcher.V8.V8JsEngine, JavaScriptEngineSwitcher.V8" />
</engines>
</core>
</jsEngineSwitcher>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment