Re: [nesta] Re: Is there a quick nesta.to_erb way?
- From:
- Nathanael D. Jones
- Date:
- 2011-05-11 @ 13:40
After using Nesta for 2 websites, I've realized that it's a lot more
efficient (for me) to use erubis and regular CSS vs. HAML and SCSS.
Debugging HAML and SCSS/SASS is extremely painful, and the parsers aren't
helpful in the slightest.
I've hacked nesta into allowing erubis/css, but I'm wondering if there might
be an better way to make haml and erubis equally easy to use in the main
distribution?
Nesta's primary strength (in my opinion) is simplicity and minimum
abstraction. HAML and SCSS seem to add indirection, abstraction, and reduce
this core strength.
To sum up, I'm asking everyone's opinion about:
1) What is the best way to make HAML and erubis/[other engine] full equals
in Nesta? Can we somehow make the template engine easily switchable? Can we
allow multiple engines to be used side-by-side, auto-detecting file
extensions?
2) What is the best way to offer users a choice between erubis/CSS and
HAML/SCSS?
On Thu, Apr 21, 2011 at 7:44 AM, Graham Ashton <graham@effectif.com> wrote:
> On 18 Apr 2011, at 12:57, Tommaso Patrizi wrote:
>
> > Can you give it a try and see if there is something wrong with it?
> >
> > If I don't activate the set directives in my app.rb I got into this
> error:
>
> That is weird; I get it too (having checked out your code). I'm afraid I
> can't look into what's going on there for at least a week, but apart from
> that it seems to be working.
>
> > If I activate them this other error:
> >
> > http://localhost:9393/
> >
> > Errno::ENOENT at /
> > No such file or directory -
> > /Users/tommasop/Sites/tommasopatrizi.com/views/not_found.haml
> >
> > The last error is pretty easy to solve copying the not_found.haml in
> > my local views but is this a default expected behavior?
>
> I got around that by changing haml() to erb() in the error handlers (git am
> style patch attached).
>
> You'll find using .rhtml inside content/pages to be a bit more difficult;
> see these lines from the Nesta gem:
>
> https://github.com/gma/nesta/blob/master/lib/nesta/models.rb#L9
> https://github.com/gma/nesta/blob/master/lib/nesta/models.rb#L92
>
>
Re: [nesta] Re: Is there a quick nesta.to_erb way?
- From:
- Graham Ashton
- Date:
- 2011-05-12 @ 12:29
On 11 May 2011, at 14:40, Nathanael D. Jones wrote:
> I've hacked nesta into allowing erubis/css, but I'm wondering if there
might be an better way to make haml and erubis equally easy to use in the
main distribution?
Without knowing how you hacked it, it's difficult to comment.
> 1) What is the best way to make HAML and erubis/[other engine] full
equals in Nesta? Can we somehow make the template engine easily
switchable? Can we allow multiple engines to be used side-by-side,
auto-detecting file extensions?
The tilt [1] gem might make this a bit more seamless than it currently is,
but I haven't really investigated. Sinatra has been built on top of tilt
for a while, but I've not had a strong enough reason to poke around with
it and see if I can find a clean way to tidy up (i.e. "make obsolete") the
rendering helpers (see [2]).
[1] https://github.com/rtomayko/tilt
[2] https://github.com/gma/nesta/blob/master/lib/nesta/overrides.rb
Sinatra 1.2 may also have a bearing; I think the view path related code
has changed (it used to enforce a requirement that all templates should
live in the same directory if rendering a view with a layout; the relevant
code may behave differently now, which would be good).
> 2) What is the best way to offer users a choice between erubis/CSS and
HAML/SCSS?
For somebody who cares enough about using engines other than haml/sass to
investigate, propose a clean solution (don't skip this bit), then send me
a patch if we can work out a good approach.
Plugins (as gems) and caching are higher on my todo list, but that
wouldn't stop me merging a good solution from somebody else, and doing a
new release.
Cheers,
Graham