1

How to add dynamic CSS source path/urls in Squishit?

 @Html.Raw(
        Bundle.Css()
        .Add("~/Styles/" + (ViewBag.SiteName ?? "default") + "/a.css")
        .Add("~/Styles/" + (ViewBag.SiteName ?? "default") + "/b.css")
        .Add("~/Styles/" + (ViewBag.SiteName ?? "default") + "/c.css")
        .Render("~/Styles/" + (ViewBag.SiteName ?? "default") + "/o#.css")
    ) 

This will throw an error.

tereško
  • 58,060
  • 25
  • 98
  • 150
bcm
  • 5,470
  • 10
  • 59
  • 92

1 Answers1

1

The problem is with the Dynamic type.

I converted the ViewBag.SiteName to String first before inserting it and it worked.

bcm
  • 5,470
  • 10
  • 59
  • 92