Contradiction in Meteor's documentation says “Meteor uses data on the wire, meaning the server sends data, not HTML, and the client renders it.”

However, says “Everything inside any tags is added to the head section of the HTML sent to the client”

So is HTML sent to the client or not??

Initially a package of js is sent to the client, this includes templates, but not rendered html. The client then renders the html, including your head section.

What the guide means to say is: Normally in meteor you don’t render the html on the server and send that to the client as is the case with many other backends.
You send data and the initial js package has everything needed to parse this in conjunction with templates and other client-side code to render the actual html that makes up a page.

Do those packages contain import statements that import HTML files? And are those HTML files also sent?

Not sure why you’d want to import html files?

Either way, just try it out and let us know the result :wink:

Because that’s what the tutorial has us doing. We create an HTML file client/body.html, and that gets imported into client/body.js. Then client/body.js gets imported into client/main.js.

Okay, we’re talking meteor 1.3 here, I thought you were importing raw html files in html files.

Once you build your meteor project for production it will bundle all your client-side code into .js files, including html files. So yes, the initial payload includes html code that you import into your client-side logic.

When importing the html files using the new syntax in 1.3 it’s not actually importing html. What the import statement does in this case is instruct meteor to parse the html into Spacebars assets which can then be rendered by Blaze. The spacebars compiler turns all your html and templates into JavaScript and so very little initial html is actually sent to the client. To see what is actually sent just right click on the page and click view page source. That being said, all of the JavaScript for all of that html is sent as well due to the inclusion of compiled JS assets in your the head of the document.

1 Like

So if I view the page source and notice one page is mostly JS, the second page being all div’s and span’s, the second one isn’t using Meteor? and the first one is?

This would be true of course, except in the case where you are using something to accomplish server side rendering. In that case you would have all the HTML, as well as all of the JavaScript sent down as well.