Close

Profile: ehubcap

Avatar

User posts

Sorry for the duplicates, tried by can't delete them

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
 

iliyan.tanev wrote:
Hi,

We are using only what nopCommerce provides for linking scripts and resources, which is bundling. The bundling of nopCommerce does not provide a way to work with CDNs, but it provides a way to override the methods that are responsible for the scripts bundling.
You could easily override the methods and refer to this StackOverflow question to make the bundling work with CDNs .

Regarding the images: all images specific to our themes are linked through the css, because they are mostly background images. If you want to use load them through CDN you will have to change the paths from the css file. 


Iliyan, I'm struggling with getting my bundles uploaded to my Azureedge end point
Can you indicate or give a heads up on how override these methods on the PageHeadBuilder.cs but is not working, This Friday I opened a ticket Support ID: 3494 that contains a succinct info on the issue
Could you give me some help with that, I'm stuck on this last barrier before starting migrating my live website to my Azure web app site
Thank you
Jose Plunkett
ehubcap  

8 years ago

Excellent, it works!
Thank you Hristian

8 years ago

Boyko wrote:
Hi,

i am using several plugins (Nop Ultimate Plugin Collection),
and my custom CSS is getting loaded BEFORE the plugin's CSS,
so when i want to overwrite some things, i need to put " !important " in my CSS which is not a very good practice.

can i have my custom CSS loaded after the plugin's CSS ??

i want to be clear, i am NOT talking about nop default "styles.rtl.css",
i am talking about PLUGIN css.

Thanks,
Shay

Hi Shay,

Yes, it is not a good practice to use !important. Basically you want to separate your changes to the css of plugins from the Ultimate Plugin Collection and to do this in the best possible manner.
There are two options here:
1. Have a separate custom.pluginname.css file i.e custom.ajaxcart.css and include this css in the view(.cshtml) file of the plugin. This approach will be working but is not the best one as you will need to go through all the plugins and modify their views and also add new files for each plugin.
2. The better approach here is to have a styles.custom.plugins.css file that is included LAST. This way any definitions in it will override the styling in the plugins and all you need to do is to include a single file (for better performance). Here is how to do this:
- Go to your theme folder i.e DefaultClean and add a new file in the Content folder styles.custom.plugins.css
- Include this file to be last by modifying the _Root.Head.cshtml file as shown below (just add the line in bold).

@Html.NopCssFiles(this.Url, ResourceLocation.Head)
    <link type="text/css" rel="Stylesheet" href="@Url.Content("~/Themes/DefaultClean/Content/styles.custom.plugins.css")" />
    @Html.NopScripts(this.Url, ResourceLocation.Head)


Now you can easily override any css definitions without the need to add !important and at the same time have all your style changes separated in a file, which will make your future upgrades a breeze.

Hope this helps!


I'm implemented this method for my custom themes and plugins CSS and it work perfect. When I activate the Nopcommerce bundling, these files are left "unbundled" which is not desirably.
How can I get these Css files included in the bundling?.
As an aside note, also i want to use Grunt for rewrite a rule to route them to a Blob Storage
any advise on feasibility?
Help please
Thank you
Jose Plunkett
ehubcap 

Hi Support, I'm upgrading to the latest version of NopTractionTheme_3.5.763.15407 but always fail when installing Nop Ajax Filters Pro with this exception:
Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.
Source Error: 
 
[code]
Line 3:  @foreach (var widget in Model)
Line 4:  {
Line 5:      @Html.Action(widget.ActionName, widget.ControllerName, widget.RouteValues)
Line 6:  }

Source File: c:\VS2013 Projects\ehubcap_Proj - Copy - test-plugins\Presentation\Nop.Web\Views\Widget\WidgetsByZone.cshtml    Line: 5 

Stack Trace: 

[IndexOutOfRangeException: Index was outside the bounds of the array.]
   SevenSpikes.Nop.Core.Helpers.ConvertToDictionaryHelper.CreateDictionaryFromSemicolonSeparatedPair(IList`1 semicolonPairValues) +623
   SevenSpikes.Nop.Plugins.AjaxFilters.Pro.Controllers.AjaxFiltersProController.N51v3MNFl() +775
   SevenSpikes.Nop.Plugins.AjaxFilters.Pro.Controllers.AjaxFiltersProController.GetWidgetFiltersPro(String widgetZone) +2914
   lambda_method(Closure , ControllerBase , Object[] ) +192
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +81
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +751
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +93
   System.Web.Mvc.Async.ActionInvocation.InvokeSynchronousActionMethod() +90
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +45
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +211
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +196
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +141
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +65
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +189
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +717
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +717
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +717
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +717
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +717
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +717
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +717
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +717
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +66
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +71
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +196
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +141
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +65
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +103
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +330
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +71
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +196
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +73
   System.Web.Mvc.Async.AsyncControllerAction

Oh! Ok I will be purchasing the plugin shorthy
Thank you Boyko and Happy New Year to you, the Nop-template team an yours families

I got this warning in the Admin page System tab after upgrading my Nopcommerce and Traction Theme to v3.50. I have a single license of the Ultimate Plugin collection for v3.40 that I'm pulling this Smart SEO plugin from.
Isn't v3.50 installation supposed to be backward compatible with versions like 3.40?
I would like to be able to continuing using my 3.40 version of the Plugin since 3.50 doesn't seem to have any substantial enhancement that I could benefit from, but it wont show after uninstalling and re installing it (SevenSpikes.Nop.Plugins.SmartSEO v3.40)
Advise
Thank you
ehubcap

Hi Denis, precisely I did that’s why I writing to you, I’m able to reproduce this bug out of the Nop Traction Demo Store with mi HTC Incredible, see attached snapshots as a reference
Thank you
Jose Plunkett
Ehubcap

The issue reappears on Nop Traction Responsive Theme, can you look at and let me know when a solution will available