Open microspino opened 12 years ago
Hmm. InterestingBonsai used to use mustache in the beginning but it was removed from 'tilt'. I recently saw a gem that re-added support for it. (https://github.com/Becojo/tilt-mustache)
So, I'd try installing the gem, then try requiring it in bonsai by adding a file called extensions.rb
in the root directory of your bonsai site.
Then, you could require 'tilt-mustache'
.
Just an idea, I haven't tried it but I'm reasonably sure it would work.
Good luck!
On 11/02/2012, at 10:33 AM, Daniele Spinosa wrote:
I really like Bonsai and i would like to add mustache templates to it, although I know Tilt doesn't suport it. How do I have to proceed? Do I need to fork your project (sorry github and gem nnewbie here).
Reply to this email directly or view it on GitHub: https://github.com/benschwarz/bonsai/issues/23
Any luck, Daniele?
On 11/02/2012, at 10:33 AM, Daniele Spinosareply@reply.github.com wrote:
I really like Bonsai and i would like to add mustache templates to it, although I know Tilt doesn't suport it. How do I have to proceed? Do I need to fork your project (sorry github and gem nnewbie here).
Reply to this email directly or view it on GitHub: https://github.com/benschwarz/bonsai/issues/23
Hello, sorry for the lack feedback. In a few word: "it works with some glitches".
Here is the commented content of my extensions.rb
.
require 'tilt-mustache'
module Bonsai
class Navigation
# without this i can't generate the main navigation links
def self.tree
pages = Page.all(Page.path, "*").select{|p| !p.floating? }.sort_by{|p| p.disk_path }
pages.map {|p| {:permalink => p.permalink, :name => p.name}}
end
end
class Page
# without this i can't generate Fig, Maple, Magic, links under varieties
def children
pages = Page.all(File.dirname(disk_path), "*").delete_if{|p| p.floating? }
pages.map {|p| {:permalink => p.permalink, :name => p.name}}
end
end
end
If I don't reopen Navigation and Page classes I get: undefined method 'permalink' for #
.
There are, probably, better ways to fix my issues but i'm not a strong ruby coder...As of today, i promise you to improve :)
I've used only the default.mustache
and products.mustache
templates until now. Here are they:
<!DOCTYPE html>
<html lang="en">
{{>templates/shared/head}}
<body id="{{slug}}">
<section id="wrapper">
{{>templates/shared/header}}
<article>
<h2>{{headline}}</h2>
<section role="main">
{{{body}}}
</section>
</article>
{{>templates/shared/footer}}
</section>
{{>templates/shared/analytics}}
</body>
</html>
<!DOCTYPE html>
<html lang="en">
{{>templates/shared/head}}
<body id="{{slug}}">
<section id="wrapper">
{{>templates/shared/header}}
<article>
<h2>{{headline}}</h2>
<section role="main">
{{body}}
</section>
</article>
<nav id="sub-navigation">
<ol>
{{#children}}
<li><a href="{{permalink}}">{{name}}</a></li>
{{/children}}
</ol>
</nav>
{{>templates/shared/footer}}
</section>
</body>
{{>templates/shared/analytics}}
</html>
Please let me know if could help more or improve this.
Hey,
That's really excellent Daniele, well done!
If I get time I'll have a go myself.
Cheers,
Ben
On Thursday, 15 March 2012 at 8:58 PM, Daniele Spinosa wrote:
Hello, sorry for the lack feedback. In a few word: "it works with some glitches". Here is the commented content of my
extensions.rb
.require 'tilt-mustache'
module Bonsai class Navigation
without this i can't generate the main navigation links
def self.tree pages = Page.all(Page.path, "*").select{|p| !p.floating? }.sort_by{|p| p.disk_path } pages.map {|p| {:permalink => p.permalink, :name => p.name}} end end class Page
without this i can't generate Fig, Maple, Magic, links under varieties
def children pages = Page.all(File.dirname(disk_path), "*").delete_if{|p| p.floating? } pages.map {|p| {:permalink => p.permalink, :name => p.name}} end end end
If I don't reopen Navigation and Page classes I get:
undefined method 'permalink' for #
. There are, probably, better ways to fix my issues but i'm not a strong ruby coder...As of today, i promise you to improve :) I've used only thedefault.mustache
andproducts.mustache
templates until now. Here are they:default.mustache
<!DOCTYPE html>
{{>templates/shared/head}}{{>templates/shared/header}} {{>templates/shared/analytics}}{{>templates/shared/footer}} {{headline}}
{{{body}}} products.mustache
<!DOCTYPE html>
{{>templates/shared/head}}{{>templates/shared/header}} {{>templates/shared/analytics}}{{>templates/shared/footer}} {{headline}}
{{body}} Please let me know if could help more or improve this.
Reply to this email directly or view it on GitHub: https://github.com/benschwarz/bonsai/issues/23#issuecomment-4516655
I really like Bonsai and i would like to add mustache templates to it, although I know Tilt doesn't suport it. How do I have to proceed? Do I need to fork your project?. Do you think it's a bad idea? Is there anything against using it in parallel but separated from tilt. Sorry github and gem newbie here this will be the first fork for me, I don't know ethics or etiquette of doing it.