Skip to content
A .Net Core rewrite and extension of the former Asp.Net Web Optimization bundling framework
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A .Net Core rewrite and extension of the former Asp.Net Web Optimization bundling framework.This project was created to support complex bootstrapping and optimization tasks for

Why NetCoreBundling

Microsoft's Asp.Net Web Optimization bundling framework offered a convenient way for configuring bundles in code. Depending on the environment Debug/Release it was possible to serve the resources in different forms (e.g. minified or not). You will say it is possible in .NET Core as well by using Gulp tasks. It is indeed possible but Gulp needs NodeJs. What if your provider didn't let you install NodeJs? Do you have to do the minification all during deployment? What if you want to debug some Javascript on site but don't want to deploy a debug version first? For all these cases we are providing NetCoreBundling.

Getting started

To use NetCoreBundling you have to install the NuGet-Package from here:

Simple usage

  • Init the BundleCollection in Configure:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, DiagnosticListener diagnosticListener)
    BundleCollection bundleCollection = app.UseBundling(env, loggerFactory.CreateLogger("Bundling"), "res", _KraftGlobalConfigurationSettings.GeneralSettings.EnableOptimization);
    bundleCollection.EnableInstrumentations = env.IsDevelopment(); //Logging enabled
	//Configure bundles
	bundleCollection.Profile("mvc").Add(new StyleBundle("cssbundle")
        .Include(@"~/css/css1.css", @"~/css/css2.css")
        .IncludeCdn(new CdnObject { CdnPath = "//", Integrity = "sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u", Crossorigin = "anonymous" })
        .IncludeCdn(new CdnObject { CdnPath = "" })
        .IncludeCdn(new CdnObject { CdnPath = "" }));
    bundleCollection.Profile("mvc").Add(new ScriptBundle("jsbundle")
        .Include(@"~/js/test1.js", @"~/js/test2.js"));

    //Bundle dirCssBundle = new StyleBundle("~/My/CssDirFiles").IncludeDirectory("/css", "*.css", true);
    //Bundle dirJsBundle = new ScriptBundle("~/My/JsDirFiles").IncludeDirectory("/js", "*.js", true);
  • Render the configured bundles:
    In your master page or razor view you have to call the created bundles:
@using ccf.CoreKraft.Web.Bundling
<!DOCTYPE html>
    <meta name="viewport" content="width=device-width" />
  • Use the default transformations

Advanced usage


This repo uses the MIT license for code. The project license documentation and other forms of content under Creative Commons Attribution 4.0.

You can’t perform that action at this time.