andrewdavey / knapsack

Project moved to https://github.com/andrewdavey/cassette
MIT License
24 stars 3 forks source link

Html helpers syntax differs from MVC built-ins #11

Open andrewdavey opened 13 years ago

andrewdavey commented 13 years ago

Knapsack adds Html.RenderScripts() and Html.RenderStylesheetLinks(). These are returning IHtmlString and used like @Html.RenderScripts()

This differs from the MVC helpers, such as @Html.Partial("name") vs @{ Html.RenderPartial("name"); }

Should Knapsack's API be updated to remove the "Render" prefix from the helper names?

jochenjonc commented 13 years ago

In MVC Render is used without @Html, it is @RenderBody() and @RenderSection(...), a logical syntax for Knapsack would be:

@RenderStyles() @RenderScripts() @RenderScripts(location: "body") or @RenderBodyScripts()

But this is only possible if you create a KnapsackWebPageBase that inherits from WebPageBase, see http://haacked.com/archive/2011/03/05/defining-default-content-for-a-razor-layout-section.aspx.

andrewdavey commented 13 years ago

I wouldn't want to force a new base class on people, so let's stick with HtmlHelper methods.

Html.RenderPartial does exist as well: http://msdn.microsoft.com/en-us/library/dd492503.aspx