1

I trying to bundle my SPA and I just can't get it to work.

My Tech Stack

WebAPI 1.0
AngularJs 1.3.X

I am just using vanilla HTML with Angular Calls to Backend WebAPI controllers. Since I am using vanilla HTML and not MVC views can I even use bundling. Do I need to return the bundled url from a WebAPI Controller?

gh9
  • 10,169
  • 10
  • 63
  • 96
  • 1
    Take a look at this: http://stackoverflow.com/questions/22345420/bundling-and-minification-without-asp-net-mvc – jpgrassi Dec 28 '15 at 14:43

1 Answers1

-1

I see it's been a year since you posted the question, but I found this post that I think answers the question in your problem.

Bundling and minification without ASP.NET MVC

It actually gives instructions on how to enable it.

  • First you have to check if you have installed the Nuget Package Microsoft.AspNet.Web.Optimization (Tools -> Nuget Package Manager -> Manage Nuget Packages for Solution)
  • Create a BundleConfig Class and define your bundles:

    using System.Web.Optimization; public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/js").Include( "~/Scripts/*.js")); bundles.Add(new StyleBundle("~/bundles/css").Include( "~/Styles/*.css")); } }

  • Register the BundleConfig class within the application start in the global.asax:

    void Application_Start(object sender, EventArgs e) { BundleConfig.RegisterBundles(BundleTable.Bundles); }

  • Reference the bundles in your HTML document.
  • Enable bundling by disabling debug mode.
Community
  • 1
  • 1
Vasiliki M.
  • 372
  • 3
  • 12
  • Ohh I just saw the answer of jpgrassi. So you should be ok. – Vasiliki M. Nov 11 '16 at 09:51
  • we chose not to go with the built in bundling, we chose this because It would force our spa to be rendered by the razor view engine. Instead we bundled it with our grunt build – gh9 Nov 11 '16 at 13:09