Another feature! Inline templates: module App::Controllers get ''/'' do @title = "My Perfect App" render :index end end __END__ @@ index.erb Welcome to <%= @title %> What''d you think? Keep or throw away? It costs us 184 bytes at the moment. // Magnus Holm
Since no-one has replied, for what it''s worth (as a very amateur camper), I''ve always been happy with simple regular Markaby views and the v2.1 options for external templates. Also, my modest one-file apps have their CSS after __END__. In any sizeable app, you''d probably want to have separate templates for easier maintenance (since - if inline - their code is going to add more than a few lines and break the one-file advantages), so the question is: will anyone use/want inline templates? - DaveE> On 25 Aug 2011, at 19:04, Magnus Holm wrote: > >> > Another feature! Inline templates: > > module App::Controllers > get ''/'' do > @title = "My Perfect App" > render :index > end > end > > __END__ > @@ index.erb > Welcome to <%= @title %> > > What''d you think? Keep or throw away? It costs us 184 bytes at the > moment. > > // Magnus Holm
I was fine with Markaby. On Thu, Aug 25, 2011 at 11:04 AM, Magnus Holm <judofyr at gmail.com> wrote:> Another feature! Inline templates: > > module App::Controllers > get ''/'' do > @title = "My Perfect App" > render :index > end > end > > __END__ > @@ index.erb > Welcome to <%= @title %> > > What''d you think? Keep or throw away? It costs us 184 bytes at the moment. > > // Magnus Holm > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20110826/922d5375/attachment.html>
If this only supports Erb, then we should throw it away as fast as possible ;) I see no reason why would anyone want to use something *that* dinosauric in a new project. If it also supports (or can support), say, Haml, then I see how it could be useful (although nearly all of my Camping projects end up split between many files anyway ;) ). Personally I love Markaby, but for many people it might look weird, and I can understand why. -- Matma Rex
On Aug 26, 2011 6:42 PM, "Bartosz Dziewo?ski" <matma.rex at gmail.com> wrote:> > If this only supports Erb, then we should throw it away as fast as > possible ;) I see no reason why would anyone want to use something > *that* dinosauric in a new project. > > If it also supports (or can support), say, Haml, then I see how it > could be useful (although nearly all of my Camping projects end up > split between many files anyway ;) ). Personally I love Markaby, but > for many people it might look weird, and I can understand why. > > -- Matma RexIt supports everything that Tilt supports. See http://github.com/rtomayko/tilt. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20110826/40093298/attachment.html>
I am a bit ambivalent about the new feature. One hand it''s kind of cool. But on the other it''s something that most experienced campers probably won''t use on moderate size apps. And for new campers it''s one more syntactic sugar to learn and remember. On 8/26/2011 10:58 AM, Magnus Holm wrote:> > On Aug 26, 2011 6:42 PM, "Bartosz Dziewon''ski" <matma.rex at gmail.com > <mailto:matma.rex at gmail.com>> wrote: > > > > If this only supports Erb, then we should throw it away as fast as > > possible ;) I see no reason why would anyone want to use something > > *that* dinosauric in a new project. > > > > If it also supports (or can support), say, Haml, then I see how it > > could be useful (although nearly all of my Camping projects end up > > split between many files anyway ;) ). Personally I love Markaby, but > > for many people it might look weird, and I can understand why. > > > > -- Matma Rex > > It supports everything that Tilt supports. See > http://github.com/rtomayko/tilt. > > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20110827/f3e6fe37/attachment.html>
A comment after some time: I''d appreciate it more if I could just have one "external" file with all the templates, and one with the Camping code, and I could "link in" the templates to parse using this mechanism. -- Matma Rex
2011/9/24 Bartosz Dziewo?ski <matma.rex at gmail.com>:> A comment after some time: I''d appreciate it more if I could just have > one "external" file with all the templates, and one with the Camping > code, and I could "link in" the templates to parse using this > mechanism.This works, although it''s kinda hacky: eval(''Camping.goes :Foo'', nil, ''templates.rb'') On Fri, Aug 26, 2011 at 16:14, Dave Everitt <deveritt at innotts.co.uk> wrote:> Since no-one has replied, for what it''s worth (as a very amateur camper), > I''ve always been happy with simple regular Markaby views and the v2.1 > options for external templates. Also, my modest one-file apps have their CSS > after __END__. In any sizeable app, you''d probably want to have separate > templates for easier maintenance (since - if inline - their code is going to > add more than a few lines and break the one-file advantages), so the > question is: will anyone use/want inline templates? - DaveEI''ve committed another patch (8b6fee67). Now you can serve static "files" too: __END__ @@ /style.css * { margin: 0; padding: 0; } It also sets the correct MIME type. The only thing I worry about now is that it''s taken a lot of bytes. We''re currently at 3976 (97%) bytes.
> On Fri, Aug 26, 2011 at 16:14, Dave Everitt <deveritt at innotts.co.uk> > wrote: >> Since no-one has replied, for what it''s worth (as a very amateur >> camper), >> I''ve always been happy with simple regular Markaby views and the v2.1 >> options for external templates. Also, my modest one-file apps have >> their CSS >> after __END__. In any sizeable app, you''d probably want to have >> separate >> templates for easier maintenance (since - if inline - their code is >> going to >> add more than a few lines and break the one-file advantages), so the >> question is: will anyone use/want inline templates? - DaveE > > I''ve committed another patch (8b6fee67). Now you can serve static > "files" too: > > __END__ > @@ /style.css > * { margin: 0; padding: 0; } > > It also sets the correct MIME type. > > The only thing I worry about now is that it''s taken a lot of bytes. > We''re currently at 3976 (97%) bytes.So further feature-creep is to be avoided. I''m also happy calling stylesheets within Markaby: head do title ''My Blog'' link :rel => ''stylesheet'', :type => ''text/css'', :href => ''/styles.css'', :media => ''screen'' end DaveE