Shout out for Blaze!

I just wanted to mention that Blaze is awesome!

It’s the most natural templating engine I ever came across and everyone using other stuff is wrong! *

*Just sending some good vibes to the Blaze community :wink:

10 Likes

Not that others are wrong but you are right :wink:

Yes!

Though I respect React, I never liked templating languages that mixed HTML directly into code. This breaks any collaboration between a designer and a developer.

Maybe I still didn’t get why React is so cool (especially in an already reactive Meteor context), but for now I really like Blaze and would like to go ahead with its approach.

3 Likes

The thing is that, when it comes to the things a developer has to do, Blaze and React aren’t that different. You take a piece of Blaze code and you just have to rearrange it to make it a React code. You’re still doing the same things (listening for events, updating variables that hold the state of the UI, inserting values into the UI, etc.)

1 Like

Yes @manuel we all know we should use viewmodel to simplify our code and cut down LOC to half :wink:

Kidding aside, I love your work!

3 Likes

Why isn’t ViewModel taking off? I feel like it does offer a lot to the typical Meteor developer, and it looks like Manuel has done a lot of work on it to make it production-ready.

1 Like

I guess it depends on what you mean by taking off - over 4000 app installs reported via atmosphere is actually pretty good (flow-router is just over 2400 right now and I think everyone would agree it’s taking off). Not to mention over a 100 github stars puts it right up there with other popular Meteor packages. All in all, it’s doing quite well. Spread the word - it’s really an amazing package! (thanks for your work on it @manuel!)

1 Like

Well, for me there is only one drawback with the syntax.

I would have loved to have

data-bind-enabled="canEnter" data-bind-hover= "showError"

instead of

data-bind="enabled: canEnter, hover: showError"

which kind of makes the code confusing to read. To be frank, I had visited the viewmodel docs a few times and been put off by that syntax until I finally decided to bite the bullet. I’m glad I did, but still, I’m not very fond of that syntax.

data-bind-enabled=“canEnter” data-bind-hover= “showError”

I actually tried that (something like v-enabled="canEnter") but the performance isn’t too good, specially on mobile. Having a single data-bind element is way faster.

Hmm, interesting, do you think there is something the community can do to help?

I mean, if you agree that that’s a better syntax, we could perhaps collaborate to make it happen. But if you are dead sure that’s really impossible (or undesirable), it’s ok.

Not dead sure but I don’t think it’s worth anyone’s time at this point. It was an idea to explore and I’ll end up using one tag like I do now, instead of multiple. I will make it configurable though. That way if you want to use data-bind=, db=, or anything else you can.

In the spirit of having less stuff on screen, I’m leaning towards using b=

<button b="enabled: canLogin, click: login">Login</button>

Check out vNext

1 Like

If “Add all vm properties as blaze helpers” is what I think it is, then wow!

Yeah, I don’t know why I didn’t do it in the first place. It’s not like it takes a toll on performance.

<body>
  {{#each people }}
    {{ name }}
  {{/each }}
<body>
Template.body.viewmodel({
  people: function() {
    return People.find();
  }
})

That should work out of the box, but right now you have to specify that people is a helper for no other reason than “the framework requires it”. It goes against the spirit of ViewModel.

3 Likes

Any idea when the next “version” might come out? A few weeks? A few months? Next year?

Yes, I would also like to know… I’m using an ‘index’ hack on multiple locations in my app, it would be great to see that feature land!

I’d like to see great improvement of performance.

I agree, and was hopeful for a second: https://twitter.com/arunoda/status/610893849615974401
But then this happened: https://twitter.com/arunoda/status/611737591285559297

Lesson of the day: Blaze supporters should be a bit more vocal :smile:

I think Blaze is compatible with ES6, is it? May be need a new expression based on ES6 for helper and event functions.

I tried a few weeks ago to start using React (mainly to found out what was all the fuss about…). It maybe only me, but the readability just killed it for me…
So yeah, let’s make more noise to get improvements on blaze :wink:

1 Like

I’d much prefer a single attribute in the majority of cases, e.g

b="if: showElement, hover: displayError, enabled: canLogin, click: login"

data-bind-* has so much repetition:

data-bind-if="showElement" data-bind-hover="displayError" data-bind-enabled="canEnter" data-bind-hover= "showError"

But I can see @serkandurusoy’s point and would use the latter for singly bound elements where it does look nicer.

.btn(b="click: doSomething")
//vs
.btn(data-bind-click="doSomething")