Thank you Iliyan for you response
i tried that iteration as well with no success
here is exactly what i did:
if (bundleFiles.Value)
{
//bundling is enabled
var result = new StringBuilder();
var partsToBundle = distinctParts.ToArray();
if (partsToBundle.Length > 0)
{
//IMPORTANT: Do not use CSS bundling in virtual categories
string bundleVirtualPath = GetBundleVirtualPath("~/bundles/styles/", ".css", partsToBundle);
//create bundle
lock (s_lock)
{
var bundleCdnPath = "https//cdn4-st1.azureedge.net{0}";
var bundleFor = BundleTable.Bundles.GetBundleFor(bundleVirtualPath);
if (bundleFor == null)
{
var bundle = new StyleBundle(bundleVirtualPath, bundleCdnPath);
//bundle.Transforms.Clear();
//"As is" ordering
bundle.Orderer = new AsIsBundleOrderer();
//disable file extension replacements. renders scripts which were specified by a developer
bundle.EnableFileExtensionReplacements = false;
foreach (var ptb in partsToBundle)
{
bundle.Include(ptb, GetCssTranform());
}
BundleTable.Bundles.Add(bundle);
BundleTable.Bundles.UseCdn = true;
BundleTable.EnableOptimizations = true;
}
}
//parts to bundle
result.AppendLine(Styles.RenderFormat("bundleVirtualPath", "bundleCdnPath").ToString());
}
return result.ToString();
}
=============================================================================================
I went beyond that and also registered the bundles in Global.asax.cs by including these code snipets:
[code]
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("favicon.ico");
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//register custom routes (plugins, etc)
var routePublisher = EngineContext.Current.Resolve<IRoutePublisher>();
routePublisher.RegisterRoutes(routes);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "Nop.Web.Controllers" }
);
}
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = true;
bundles.UseCdn = true;
}
}
protected void Application_Start()
{
//disable "X-AspNetMvc-Version" header name
MvcHandler.DisableMvcResponseHeader = true;
//initialize engine context
EngineContext.Initialize(false);
bool databaseInstalled = DataSettingsHelper.DatabaseIsInstalled();
if (databaseInstalled)
{
//remove all view engines
ViewEngines.Engines.Clear();
//except the themeable razor view engine we use
ViewEngines.Engines.Add(new ThemeableRazorViewEngine());
}
//Add some functionality on top of the default ModelMetadataProvider