How to add dynamic CSS source urls in Squishit?


Tags: css,asp.net-mvc,razor,compression,squishit

Problem :

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.



Solution :

The problem is with the Dynamic type.

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


    CSS Howto..

    using css modules in react how can I pass a className as a prop to a component

    How to avoid clipping in CSS?

    How to add and use jquery and css file in joomla module..?

    How Do I Place An Image To The Right of a Body of Text?

    CSS - how to overwrite using CSS?

    how to use css button to post method in a form?

    How to display loading.gif at the center of the screen which has a scrollbar

    How to reference nested classes with css?

    How to use objects returned by a function?

    How to change header and footer to full width

    How to draw solid/dotted/dashed lines using most basic HTML/CSS possible (for tcpdf to render them correctly)

    How can i use the visibility attribute in css to make my submenu appear and reappear?

    how to manage layers in position:absolute css block

    CSS. Parent > Child1:hover. How to display Parent > Child2?

    How to disable parent hover, when hovering over child

    How can I take advantage of Sass, for example, in rendering FizzBuzz?

    How do I set a block of text to drop to a new line all at once?

    how to add classes to the dropdown menu in the TinyMCE table editor

    How to let 3 div columns extend the height until hit the bottom of the page?

    How do I prevent a JQuery UI menu from floating?

    CSS how to align group of elements horizontally?

    How to change css file for this aim?

    How to debug CSS with Firebug for an element that only appears when clicked?

    How to make
  • expand with CSS (like Apple.com)
  • How to include css in my JSP?

    How to change position of Semantic UI sidebar for different screen sizes?

    How to cancel left or right rules with an !important tag?

    How to make pure CSS dropdown menu appear with a fade in/slowly

    Showing/hiding content with jQuery

    How to change CSS style of nested list items?