In Meteor, how do I visualize server-side templates?

I completed this tutorial and I built it with this: http://x111.meteor.com/ But, as you can see, the download is very slow because the meteorite is loading data from the client side.

I get this error when I want to use the global Templateinside Meteor.isServer:

ReferenceError: Template is not defined
at app/products.js:56:3 ...

How can I serve the templates from the server side, so I do not need to wait for the client?

+5
source share
4 answers

this. Meteor. , Meteor .

> mrt add handlebars-server
+6

, html. , , - .

: , , , Templating.

. , / , -.

, ..., , .

{{#unless CartItems.count}}
    <tr>
        <td colspan="4">Loading...</td>
    </tr>
{{else}}
    {{#each CartItems}} 
        <tr>
           <td>{{Name}}</td>
           <td>${{Price}}</td>
           <td>{{Quantity}}</td>
           <td>${{Total}}</td>
        </tr>
     {{/each}}
{{/unless}}
+1

, - ( " " ):

spiderable . Meteor HTML - inital . Meteor .

(http://meteor.com/faq/can-meteor-serve-static-html)

While people will say that this violates the philosophy of β€œjust send data over the wire,” for sites that need good SEO, this is very necessary, as well as a very natural thing, when you have the same language and template framework available both for server and client.

+1
source

If you are looking for this type of functionality in a Node.JS framework, I would recommend using Derby.JS http://derbyjs.com/

+1
source

All Articles