Any way to support Ractive.js a server-side template engine?

156 views
Skip to first unread message

gihrig

unread,
Feb 8, 2015, 12:06:32 PM2/8/15
to mimo...@googlegroups.com
I'm using ractive.js as my client-side template engine. I'm working on an 'isomorphic' app where the view is compiled server-side, delivered to the client and then updated on the client. It would be very nice to have the same template engine on server and client.

Prior to setting up Mimosa I'm compiling templates server-side in my node JS code. Mimosa config server:views:compileWith demands an entry, and Mimosa complains ractive is not supported here.

* server.views.compileWith must be one of the following: jade, hogan, html, ejs, handlebars, dust.


If I remove server:views all together Mimosa complains

 * server.views.path src/views) cannot be found


Any work-around?

dbashford

unread,
Feb 8, 2015, 12:44:44 PM2/8/15
to mimo...@googlegroups.com
Many of the settings in mimosa-server are there to facilitate someone using "mimosa new" to set up a server.  But as long as you aren't using the embedded server (you have your own node server) its really up to you whether you use the values you set in the "server" settings inside your server.

So, one workaround is to leave the config alone (just let it be the defaults wherever you need it to validate properly) and then just don't use the default settings you don't need.  Mimosa itself isn't a server oriented tool, so whatever you choose to do with your server is your own business as far as Mimosa is concerned, as long as you call the callback.

Hope that helps!
Message has been deleted

gihrig

unread,
Feb 10, 2015, 1:05:51 AM2/10/15
to mimo...@googlegroups.com
That helps, I can move on with my project.

What's involved in adding server-side support for ractive? 
Is this something I can easily do myself?

dbashford

unread,
Feb 10, 2015, 10:26:27 AM2/10/15
to mimo...@googlegroups.com
Yep!  Would be pretty easy since Ractive is supported via consolidate: https://github.com/tj/consolidate.js.

Usually, though, when including a newly supported templater, I also update the "mimosa new" command to incorporate that technology as an option.  I'm happy handling that part.

With Mimosa 3.0, about 2-4 weeks away at current pace, mimosa-server will be pulled out of Mimosa as a built-in dependency, which frees me to include more templating options.  Right now, if you add ractive to mimosa-server, you are also essentially adding ractive to mimosa, and I don't want to build up the dependencies at this point.  Ractive needs to become a dependency of mimosa-server in order to support Mimosa's embedded server.

So, the gist is, if you want to add it to mimosa-server, you can, and once 3.0 releases, I can add Ractive to the "mimosa new" scaffolding.  The amount of work to add it is fairly trivial.  Needs to be in the package.json, needs to be validated as ok.  Then verify the internal and external versions work ok.
Reply all
Reply to author
Forward
0 new messages