Castle Blade

43 views
Skip to first unread message

hammett

unread,
Jun 16, 2011, 1:44:43 PM6/16/11
to castle-pro...@googlegroups.com
Just pushed to the MR repository. As the name implies, it is a
variation of MS' Razor, with a few additions:
- ability to name lambda parameters (in razor the name is fixed as "item")
- ability to have nested lambda blocks

This is kind of essential to create a decent helper API for MR3,
that's why I had to go into the trouble of creating it.
It's not fully operational yet, but should be quite soon. Code reviews
are appreciated.

https://github.com/castleproject/Castle.MonoRail3/tree/master/src/Castle.Blade

--
Cheers,
hammett
http://hammett.castleproject.org/

Rafael Teixeira

unread,
Jun 17, 2011, 12:46:08 PM6/17/11
to castle-pro...@googlegroups.com
Wonderful news

Rafael "Monoman" Teixeira
---------------------------------------
"The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' (I found it!) but 'That's funny ...'"
Isaac Asimov
US science fiction novelist & scholar (1920 - 1992)



--
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en.


Mike Murray

unread,
Oct 4, 2011, 12:13:07 PM10/4/11
to castle-pro...@googlegroups.com
In talking with the Nancy Framework guys and Sebastien Lambla of OpenRasta, it is a nightmare to try and support the Razor view engine on any open source web framework because of its tight coupling to ASP.NET. It's becoming clear you can't just rip it out and use it elsewhere (thanks Microsoft). In the FubuMVC project, we have stonewalled anyone asking for Razor support. We would like to support the syntax, as many interested in using the framework are asking for it and we know it would increase adoption because transitioning would be easier for most teams/companies if it were supported. Somebody mentioned Blade, and so here I am inquiring more. :)

The promise of Blade sounds enticing, 100% compatibility with Razor, some extra nice syntax additions, and that the quality of the codebase has got to be in better shape than what is coming from MS. What is the current state of Blade? Is Blade available as a standalone download separate from MonoRail? Is it ready to be utilized in another web framework? Anything else I should know before embarking?

The vision I have is for a user to be able to download FubuMVC (from something like NuGet) and also go download Blade and have them work together seamlessly because of a FubuMVC adapter for Blade that lets it work as one of many possible view engines for FubuMVC.

Thanks in advance.

Mike Murray
@mkmurray

hammett

unread,
Oct 4, 2011, 1:21:52 PM10/4/11
to castle-pro...@googlegroups.com
git pull g...@github.com:castleproject/Castle.MonoRail3.git

And go to /src/Castle.Blade

> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Development List" group.

> To view this discussion on the web visit
> https://groups.google.com/d/msg/castle-project-devel/-/T79kaSYiJY0J.


> To post to this group, send email to castle-pro...@googlegroups.com.
> To unsubscribe from this group, send email to
> castle-project-d...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/castle-project-devel?hl=en.
>

--
Cheers,
hammett
http://hammett.castleproject.org/

Ken Egozi

unread,
Oct 4, 2011, 1:42:30 PM10/4/11
to castle-pro...@googlegroups.com
What parts of razor did you find troublesome to use outside of aspnet?

It actually is made of two things. 
First a compiler that transforms cshtml files to codedom classes, and then a viewengine runtime (which takes care of layouts partials and writing to the response stream). The latter is aspnet specific however you can customize the compiler to generate classes that would fit a custom view engine. 

I did a proof of concept a while back for using razor files and feed them to a monorail view engine (aspview) and it was surprisingly easy.   . There is also a project that uses razor syntax to create class templates (like t4) 


Sebastien Lambla

unread,
Oct 4, 2011, 1:59:21 PM10/4/11
to castle-pro...@googlegroups.com

The template language itself has its code in one assembly, but then most of the functionality is actually in webpages, which is not open-source and hard to extend, and have a non-windows platform restriction in the license. It’s also causing a whole bunch of issues with the need to have custom build managers in some scenarios.

Ken Egozi

unread,
Oct 4, 2011, 2:16:23 PM10/4/11
to castle-pro...@googlegroups.com
As I said - the non-template functionality is per the target viewengine. You won't expect to be using MVC's html helpers in a Nancy application, so the supplied base class (WebViewPage or whatever) is irrelevant. 
It is also likely that Blade will also not fit an environment that abstracts (or does not use) ASP.NET's Response object, so you will not be resuing these parts anyway.

The view-engine code itself (deal with partials, layouts, sections etc.) is not a difficult task.
IMO the web framework should supply that part (as well as the base-class functionality) and have view-engines implementors generate compatible codedom out of templates.

AspView for example have a rather good separation between these parts, and the runtime part is almost ASP.NET free (it currently loads Request parameters into the PropertyBag and is aware of MonoRail's ControllerContext, but the first could be discarded and the latter abstracted to IDictionary)

I once wanted to generalize AspView to be a generic view-engine runtime, and then plug Brail and Razor syntaxes into it, but never got the time for that. 
Other frameworks (fubu, rasta, Monorail, Nancy, even MVC3 assuming one wants to optimise view execution) could enjoy an optimized runtime (the thing that given compiled views, a PropertyBag and a TextWriter can render the templates), with pluggable compilers (on one side) and framework-to-property-bag-and-text-writer adapters on the other.

If only I had some free time I'd have loved to work on this. Not in the coming couple of months - that's for sure


Ken Egozi.
http://kenegozi.com/blog
http://social.sears.com
http://www.musicglue.com
http://www.castleproject.org
http://www.idcc.co.il - הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם

hammett

unread,
Oct 4, 2011, 2:34:24 PM10/4/11
to castle-pro...@googlegroups.com
On Tue, Oct 4, 2011 at 11:16 AM, Ken Egozi <ego...@gmail.com> wrote:
> It is also likely that Blade will also not fit an environment that abstracts
> (or does not use) ASP.NET's Response object, so you will not be resuing
> these parts anyway.

Actually Blade has no dependency on asp.net.

Reply all
Reply to author
Forward
0 new messages