Copied to clipboard

Flag this post as spam?

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


  • Tom Bruce 122 posts 506 karma points
    Jan 10, 2018 @ 20:47
    Tom Bruce
    0

    Optimisation - bundles

    Hi everyone, I cannot get my bundle to work. I am using Umbraco version 7.6.3 assembly: 1.0.6361.21154.

    I have created folder called App_Start within my project. I have added a class within the folder called BundleConfig.cs

    Class code

    public class BundleConfig : IApplicationEventHandler
    {
        public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication,
        ApplicationContext applicationContext)
        { }
    
        public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication,
           ApplicationContext applicationContext)
        {
            //Scripts
            BundleTable.Bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
               "~/scripts/jquery.min.js",
               "~/scripts/jquery.easing.1.3.js",
               "~/scripts/bootstrap.min.js",
               "~/scripts/jquery.waypoints.min.js",
               "~/scripts/main.js"
               ));
    
            //CSS
            BundleTable.Bundles.Add(new StyleBundle("~/bundles/style").Include(
               "~/css/animate.css",
               "~/css/icomoon.css",
               "~/css/simple-line-icons.css",
               "~/css/bootstrap.css",
               "~/css/style.css",
               "~/css/BootstrapOveride.css",
               "~/Content/font-awesome.min.css"
               ));
        }
    
        public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        { }
    }
    

    I have also added the following code to the appSettings within the webconfig

     <add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/bundles/" />
    

    I have also set the debug to false within the webconfig any pointers much appreciated.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jan 11, 2018 @ 08:58
    Dave Woestenborghs
    0

    Hi Tom,

    What is the problem with your bundle ? Is not rendering anything or just not bundled and minified ?

    Dave

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jan 11, 2018 @ 10:31
    Dave Woestenborghs
    0

    By the way...I once created a package that allows you to main your bundles through a config file :

    https://our.umbraco.org/projects/developer-tools/booteasy-client-bundling/

  • Steve Morgan 1349 posts 4458 karma points c-trib
    Jan 11, 2018 @ 10:03
    Steve Morgan
    0

    Hi,

    Have you added a Global.asax.cs file and changed the Global.asax to reference it?

    <%@ Application Inherits="YOURNAMESPACE.Global" Language="C#" %>

    That's the bit I always forget to do :)

    These references help:

    Steve

  • Tom Bruce 122 posts 506 karma points
    Jan 11, 2018 @ 12:05
    Tom Bruce
    0

    Hi everyone, my bundle looks like it's being fired with I step through the debugger, but still no CSS or JS

    When I viewed the page source code the bundles are empty

    <link href="/bundles/css" rel="stylesheet"/>
    

    enter image description here

  • Steve Morgan 1349 posts 4458 karma points c-trib
    Jan 11, 2018 @ 12:16
    Steve Morgan
    100

    You've named the bundle /bundles/style

    So hit that in the browser - does that work?

  • Tom Bruce 122 posts 506 karma points
    Jan 11, 2018 @ 13:49
    Tom Bruce
    0

    Thanks Steve and thank you everyone for your help much appreciated :)

  • Steve Morgan 1349 posts 4458 karma points c-trib
    Jan 11, 2018 @ 13:54
    Steve Morgan
    0

    You're very welcome! Glad to help - definitely been there - amazing what a fresh pair of eyes does to your sanity!

Please Sign in or register to post replies

Write your reply to:

Draft