Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter S 169 posts 587 karma points
    Aug 25, 2014 @ 08:13
    Peter S
    0

    MVC Bundling in Umbraco 7

    Is there anything you kneed to do differently in Umbraco to make bundling work? I keep doing the same procedure that I always do (add the bundle in BundleConfig.cs, register that bundle in Global.asax and render it in the view) but I can't get it to work.

  • Comment author was deleted

    Aug 25, 2014 @ 10:03

    Try doing it with an ApplicationEventHandler (add bundles on application started) http://our.umbraco.org/documentation/Reference/Events/application-startup

    Or you can also give this package a try: http://our.umbraco.org/projects/developer-tools/optimus

  • Peter S 169 posts 587 karma points
    Aug 25, 2014 @ 11:23
    Peter S
    0

    Are you suggesting something like this?

    public class RegisterEvents : ApplicationEventHandler
    {
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
    }

  • Comment author was deleted

    Aug 25, 2014 @ 11:24

    @Peter yup

  • Peter S 169 posts 587 karma points
    Aug 25, 2014 @ 11:34
    Peter S
    0

    I tried it but it gives me the error message:

    Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    I added WebGrease via NuGet and the lines below to web.config but it still throws the same error. Any clue why?

    <dependentAssembly>
      <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-1.5.1.25624" newVersion="1.5.1.25624" />
    </dependentAssembly>

  • Comment author was deleted

    Aug 25, 2014 @ 11:35

    Sure it's that version of WebGrease that is installed v1.5.1.25624 ?

  • Peter S 169 posts 587 karma points
    Aug 25, 2014 @ 11:38
    Peter S
    0

    Nope! :) I checked meanwhile I was waiting for your reply and it was a new version. Thanks for all your help!

  • Comment author was deleted

    Aug 25, 2014 @ 11:39

    Great, glad it's sorted :)

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Aug 25, 2014 @ 12:04
    Jeroen Breuer
    1

    Hello,

    I used bundling too, but now I'm using Cruncher. It works much easier and also supports external sources.

    Jeroen

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Apr 29, 2015 @ 17:46
    Alex Skrypnyk
    0

    Hi Jeroen,

    We struggling with the same issue, bundles isn't easy to implement in the Umbraco projects, can you provide some details how to setup Cruncher quickly ?

    Thanks, Alex

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Apr 29, 2015 @ 17:53
    Alex Skrypnyk
    0

    Why did you prefer Cruncher against Optimus? What is better in performance ?

    Thank,

    Alex

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Apr 29, 2015 @ 18:02
    Jeroen Breuer
    1

    Hello,

    We stopped using Cruncher. The only reason for that is that we don't want to do the bundling server side. Instead our frontenders already bundle and minify it with gulp. That way we only need to include those files and don't need to do anything in Razor or C#.

    Jeroen

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Apr 29, 2015 @ 18:19
    Alex Skrypnyk
    0

    Thanks, Jeroen, it makes sense.

Please Sign in or register to post replies

Write your reply to:

Draft