Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Propose: Just JADE feature #164

Open
teintinu opened this issue Sep 1, 2015 · 7 comments
Open

Propose: Just JADE feature #164

teintinu opened this issue Sep 1, 2015 · 7 comments

Comments

@teintinu
Copy link

teintinu commented Sep 1, 2015

The idea is that a single jade file generates all the code needed to Meteor. At least the client side.

For example, something like that:

sample.jade

head
  title Sample
body
  h1 Welcome to Meteor!
  +hello
script(isClient).
  Session.setDefault('counter', 0);
script(isServer).
  Meteor.startup(function () {
    // code to run on server at startup
  });

template(name="hello")
  button Click Me
  p You've pressed the button {{counter}} times.
  script(helper="counter").
      return Session.get('counter');
  script(event="click button").
      // increment the counter when button is clicked
      Session.set('counter', Session.get('counter') + 1);

will generate something like this:

sample.html

<head>
  <title>Sample</title>
</head>

<body>
  <h1>Welcome to Meteor!</h1>

  {{> hello}}
</body>

<template name="hello">
  <button>Click Me</button>
  <p>You've pressed the button {{counter}} times.</p>
</template>

sample.js

if (Meteor.isClient) {
  // counter starts at 0
  Session.setDefault('counter', 0);

  Template.hello.helpers({
    counter: function () {
      return Session.get('counter');
    }
  });

  Template.hello.events({
    'click button': function () {
      // increment the counter when button is clicked
      Session.set('counter', Session.get('counter') + 1);
    }
  });
}

if (Meteor.isServer) {
  Meteor.startup(function () {
    // code to run on server at startup
  });
}
@mquandalle
Copy link
Owner

So basically the idea would be to support script tag I guess. This is similar to what http://riotjs.com/ does for instance. I'm waiting for more feedback from users.

@teintinu
Copy link
Author

teintinu commented Sep 1, 2015

Yes, it's similar to riotjs.
Ok, after you decide, If I can help you something just call me.

@jakobrosenberg
Copy link

I'd love a react/riot-like approach for Meteor. React feels too big and riot doesn't like Meteor much. If you could make something similar, Jade would be the cherry on top.

At a glance riot seems to support Jade as well. http://riotjs.com/guide/compiler/

@laurentpayot
Copy link

I don't understand the hype around mixing view code and controller code. Seems like a step back to me, maybe younger coders never had to deal with the issues that come with it. Some friends had big problems maintaining react "soup-code" recently...

@jakobrosenberg
Copy link

To each their own. I personally feel components are often too scattered throughout Meteor. postPublish.js, postSubscribe.js, postCollection.js, postMethods.js, postsList.js, postsList.html, postsList.css, postView.js, postView.html, postView.css, etc. etc.

I prefer separation of components over separation of technologies.

@laurentpayot
Copy link

I see what you mean. For now I'm just waiting for web components to arrive to see if they are less messy.

@crapthings
Copy link

but what if we use coffeescript ?

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

No branches or pull requests

5 participants