meteor-jade
meteor-jade copied to clipboard
Propose: Just JADE feature
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
});
}
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.
Yes, it's similar to riotjs. Ok, after you decide, If I can help you something just call me.
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/
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...
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.
I see what you mean. For now I'm just waiting for web components to arrive to see if they are less messy.
but what if we use coffeescript ?