After upgrading to 9.3 from 8.2.3, css (and I assume script) bundling is not working. When I view the page source, it LOOKs like it should be working; I see the css bundle link, but the page is displayed without the styling and when I try to go to the url directly, it gives 404. The same issue applies to script bundling as well. To transition from 8.2.3, I installed a fresh 9.3 copy and applied our update to it.
Here's the line where the bundled css is:
<link href="/bundles/dkg/styles?v=VJ7wdTUwgYwRwofmoFSeVOVnogFiB0FfKncSPbWvPII1" rel="stylesheet"/>
Going directly to the url gives me a page not found.
Here's the code for my RegisterBundles.cs:
using Sitecore.Pipelines;
using System.Web.Optimization;
namespace Dkg.Web.App_Start
{
public class RegisterBundles
{
public void Process(PipelineArgs args)
{
#if DEBUG
BundleTable.EnableOptimizations = false;
#endif
var bundles = BundleTable.Bundles;
bundles.Add(new StyleBundle("~/bundles/dkg/styles")
.Include("~/Content/Lib/owl-carousel/owl.carousel.css", new CssRewriteUrlTransform())
.Include("~/Content/Lib/owl-carousel/owl.theme.default.css", new CssRewriteUrlTransform())
.Include("~/Content/Lib/odometer/odometer-theme-default.css", new CssRewriteUrlTransform())
.Include("~/Content/Lib/fancybox/jquery.fancybox.css", new CssRewriteUrlTransform())
.Include("~/Content/Dkg/Styles/dkg.css", new CssRewriteUrlTransform())
.Include("~/Content/Dkg/Styles/rte.css", new CssRewriteUrlTransform())
);
bundles.Add(new ScriptBundle("~/bundles/dkg/scripts")
.Include("~/Content/Lib/jquery-3.2.1.js")
.Include("~/Content/Lib/jquery.matchHeight.js")
.Include("~/Content/Lib/owl-carousel/owl.carousel.js")
.Include("~/Content/Lib/d3.js")
.Include("~/Content/Lib/odometer/odometer.js")
.Include("~/Content/Lib/jquery.waypoints.js")
.Include("~/Content/Lib/fancybox/jquery.fancybox.js")
.Include("~/Content/Dkg/Scripts/sitecore-tracking.js")
.Include("~/Content/Dkg/Scripts/main.js")
.IncludeDirectory("~/Content/Dkg/Scripts/Components", "*.js", true)
);
}
}
}
And the lines in razor where I load them:
@Styles.Render("~/bundles/dkg/styles")
and
@Scripts.Render("~/bundles/dkg/scripts")
This all worked fine in 8.2.3