main file has the following code:
define(['can', 'tests/test.mustache!', 'tests/testcomponent.mustache'], function(can, template, componenttemplate) { can.Component.extend({ tag: 'some-component', template: componenttemplate, viewModel: { some: 'componentdata' } }) var Test = can.Control.extend({ init: function(el) { can.$(el).html(template({ testData: 'controllerdata' })) } }) return function(request) { var test = new Test(document.body); } })
some-component stays unrendered as <some-component></some-component>
what should i do to render this?
What is ‘body.document’? Thats not working like this way.
please look into donejs-serve https://github.com/donejs/done-serve/blob/master/lib/index.js
how to set up express with done-ssr-middleware
document.body is a vdom node, i think. According to https://github.com/donejs/done-ssr my main should export a render function.
I set up middleware this way
var ssr = require('done-ssr-middleware');
var app = express();
app.use('/', ssr({
config: __dirname + '/package.json!npm',
}));
This method and can-serve are about solving the same problem,aren’t they? both of them can server-side render?
can.view.callbacks._tags says that callback is already prepared, but not triggered.
I want to set up server-side rendering for an already written project with canjs + stealjs. Thus, I decided to use done-serve. While i use only can.Control, everything works, but can.Component does not work and I do not know why. The example I put on git https://github.com/v1ar31/testdone. How can i properly use the done-serve, to render can.Component on server?
It helped to rename .mustache -> .stache
Did that fix it for you? I’m guessing mustache does not render server-side.