Render html file on client


#1

I’m have a .html file in my private folder and I am trying to access it on the client.
In that file there are some Spacebars.

On the server I can simply do:

SSR.compileTemplate('invoice_comp_tmpl', Assets.getText('file.html'));
```

```
    var html_string = SSR.render('layout', {
      css: css,
      template: "invoice_comp_tmpl",
      data: data
    });
```

I know about ```Blaze.toHTMLWithData(Template, data)```.
But I can't get it to work.
Any Ideas?

#2

The private folder is accessible only from server code: https://guide.meteor.com/structure.html#special-directories


#3

So I should put the .html file in the public folder.
What is the client side equivalent to Assets.getText()?


#4

.html (template) files are built automatically on the client - you don’t need to do anything.


#5

Ok my bad.
Maybe I should have elaborated a little bit more on what I am trying to do.
Sorry about that.

I’m using a package that requires a html string to generate a pdf:

    Meteor.pdf.stream(html_string, function(result) {
      window.open(result);
    });