Closed brauliobo closed 9 years ago
You can do it by adding .tag
extension to .jst.skim
files, so finally extension should be .jst.skim.tag
. So that will be handle by jst, skim and tag engines.
@gkopylov Actually it generated javascript not the HTML needed for Riot.
I'm going to generate a simple html using Skim and ExecJs. How can I do server side rendering to HTML? I've tried Skim::Template.new{ 'p' }.render
but it only return javascript.
@brauliobo yeah, you are right, but skim oriented for client side view, so it is compiled to JST template and render it on server side could be a bit tricky(but sure you can do it via ExecJS like it goes here https://github.com/jfirebaugh/skim/blob/master/test/helper.rb ).
For server side view I recommend you to use slim https://github.com/slim-template/slim
thanks @gkopylov, the main goal is to have isomorphic templates, so they can be used on Rails and on the Browser.
I'm trying some workarounds to use Slim, see https://github.com/slim-template/slim/issues/650
It is very interesting idea and I tried it earlier, but as a final result you will come to different context - in client side you will work with js objects(and then past it on skim template) and on server side you will need to serialize ruby objects and then past it in precompiled skim template, so not that simple and useful. Moreover you need to somehow create DOM on server side to proper work with output html. So I left this idea. But maybe you could do it better so good luck.
@gkopylov About serialization of ruby objects to json, I think this is necessary one way or another, for APIs and dynamic interfaces.
Then, execjs
(with therubyracer
) can render Riot's .tag
files (after slim compilation of .tag.slim
) quite simple and fast in my benchmarks.
Ok, I wish you to get excellent results for isomorphic templates and resolve all issues for this.
Btw, try Turbolinks 3, it is really blazing fast, so you no need to use that hipsterish technology like Virtual dom and etc.
I would like to
.js.tag.skim
files to be compiled to html so that I could use it with Riot as described at http://riotjs.com/guide/compiler/#pre-processorsHow could that be done? Maybe a
.html.skim
sprockets processor?