Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor front-end templates & views #21

Closed
niallo opened this issue Mar 9, 2013 · 15 comments
Closed

refactor front-end templates & views #21

niallo opened this issue Mar 9, 2013 · 15 comments
Assignees

Comments

@niallo
Copy link
Member

niallo commented Mar 9, 2013

Jade is non-standard and poses a barrier to people contributing, as does the mishmash of backbone, apres and handrolled JS.

Suggestions for better solutions welcome.

@viniciusgama
Copy link
Contributor

what is the plan? just curious since I'm feeling the pain to read all this jade code 👍

@niallo
Copy link
Member Author

niallo commented Mar 10, 2013

Yeah, definitely won't be Jade. I'm not sure what to use yet instead. Any suggestions?

/cc'ing @peterbraden for some pointers...

@peterbraden
Copy link
Contributor

Yeah, I don't really know what the best template engine for node is at the moment. They all seem to suck in their own ways :)

Definitely want to look at a system where you can do modular views with templates so it's easy to add view code as plugins - dashboards etc.

@caseman
Copy link

caseman commented Mar 12, 2013

Templates, almost by definition lack modularity. Something I was trying to address with dolphy.js until I realized I don't have any web apps I want to write in my spare time anymore ;) But the other main benefit was that they are valid JS data structures (JSON), so there is no parser, and you can manipulate them in code. Downside might be lack of beauty (ala Jade), but as I think we've determined, that's only skin deep.

@caseman
Copy link

caseman commented Mar 12, 2013

Anyway if nothing else floats your boat, you can probably convince me to work on dolphy again. The code and tests are solid, but it totally lacks docs and real-world use. Obviously writing some docs would be priority zero. It is designed to work with node and requirejs out of the box, so it could be used both server and client-side.

@niallo
Copy link
Member Author

niallo commented Mar 12, 2013

Current suggestions:

Thoughts/additional ideas?

@caseman
Copy link

caseman commented Mar 12, 2013

there's always handlebars: http://handlebarsjs.com/

IMHO ejs and swig smell too much like JSPs.

@caseman
Copy link

caseman commented Mar 12, 2013

I'm also curious what soured you on Jade. Can't be the significant whitespace ;)

@peterbraden
Copy link
Contributor

Jade syntax is super ugly and hard to parse, I personally detest template
engines that eschew html.

I actually like swig - template inheritance is super useful in this sort of
scenario. EJS is also widely known and used, so is a reasonable choice.

handlebars is a little too logicless to be easy to use here - while it's
great for manipulating snippets of html, it gets clunky when you're doing
the whole page.

There's also a bunch more engines - I'd be interested to look at some of
the ones that include clientside rendering too.

On 12 March 2013 15:31, Casey Duncan notifications@github.com wrote:

I'm also curious what soured you on Jade. Can't be the significant
whitespace ;)


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-14810251
.

Peter Braden

http://PeterBraden.co.uk/

@viniciusgama
Copy link
Contributor

What about Bliss (https://github.com/cstivers78/bliss)? Is a javascript implementation of the asp.net razor view engine. Pretty easy.

@peterbraden
Copy link
Contributor

I personally don't like template engines that embed a language within another, the less logic the better imho.

On Mar 12, 2013, at 8:28 PM, Vinícius Gama notifications@github.com wrote:

What about Bliss (https://github.com/cstivers78/bliss)? Is a javascript implementation of the asp.net razor view engine. Pretty easy.


Reply to this email directly or view it on GitHub.

@viniciusgama
Copy link
Contributor

you're talking about the way it uses javascript inside the view?

@function display(product) {
  <li>@product.name ($@product.price)</li>
}

<ul>
  @products.forEach(display)
</ul>

@peterbraden
Copy link
Contributor

Right

On Mar 12, 2013, at 9:10 PM, Vinícius Gama notifications@github.com wrote:

you're talking about the way it uses javascript inside the view?

@function display(product) {

  • @product.name ($@product.price)
  • }
      @products.forEach(display)


    Reply to this email directly or view it on GitHub.

    @ghost ghost assigned peterbraden Mar 18, 2013
    @niallo
    Copy link
    Member Author

    niallo commented Mar 18, 2013

    Think swig makes the most sense. @peterbraden's argument is to use template inheritance for the nascent front-end extension system.

    @peterbraden
    Copy link
    Contributor

    We're now using swig. Fixed!

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants