Skip to content

Instantly share code, notes, and snippets.

@takempf
Created February 20, 2014 20:23
Show Gist options
  • Select an option

  • Save takempf/9122430 to your computer and use it in GitHub Desktop.

Select an option

Save takempf/9122430 to your computer and use it in GitHub Desktop.
Use browserify + hbsfy to render solidus widgets client side
var $ = require('jquery');
// Set up hbsfy for Solidus feature parity
var Handlebars = require('hbsfy/runtime');
// Pull in Handlebars helpers
var HandlebarsHelper = require('handlebars-helper');
HandlebarsHelper.help( Handlebars );
// Set partials
Handlebars.registerPartial( 'favorite', require('../../views/favorite.hbs') );
var favorites_template = require('../../views/favorites.hbs');
$(function(){
$('body').append( favorites_template( solidus.context.resources.favorites ) );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment