Mvc4 linking strongly typed bundles

So MVC 4 introduces a script and style set. This allows:

public static void RegisterBundles(BundleCollection bundles)
    {
    bundles.Add(new ScriptBundle("~/bundles/mobile").Include(
                    "~/Scripts/jquery.mobile-*"));

then used as a razor:

@Scripts.Render("~/bundles/mobile")

My question is: why should I print "~/bundles/mobile"? Is there a way to get intellisence to have a strongly typed object to pick up? Otherwise, I have to go see it to make sure that I call it the same thing.

I would like to do something like this: (I know that this will not compile in this way, this is just an example)

public static void RegisterBundles(BundleCollection bundles)
    {
    Bundle mobile = new Bundle("mobile");
    mobile.AddFile("w/e")
    bundles.Add(mobile);

//in page:
 @Scripts.Render(BundleConfig.mobile)

or something in this influence.

Edit : The answer is so simple. Because it @Hao Kungindicates that it @Styles.Rendersimply takes a string of url string. I created a class to keep patches.

public class bundles
{
    #region Javascript
    public static string scripts = "~/bundles/scripts";
    ...
    #endregion

    #region CSS

    public static string css = "~/Content/css";
    public static string jqueryUi = "~/Content/themes/base/css";
    ...
    #endregion
}

on any page, then you just do

@Styles.Render(bundles.jqueryUi)

. , , , .

+5
1

Render Scripts/Styles Render , URL-, , , - .

+2

All Articles