javascript - Can I override a method in a JSPM package? -


i'm migrating project use jspm & systemjs. in app, override backbone marionette render method use mustache templates:

marionette.renderer.render = function (template, data) {      return mustache.render(template, { model: data }, partials); } 

this simple in old world - have above code after marionette js , mustache js have been added page. can't see how override when i'm loading module though.

import * marionette "backbone.marionette"; 

if problem loading order can, instance, create new (i.e. custom) marionette module depends both on backbone.marionette , mustache , extends marionette. like

import marionette 'backbone.marionette'; import mustache 'moustache';  marionette.renderer.render = function (template, data) {  return mustache.render(template, { model: data }, partials); }  export default marionette; 

after that, you'll need map custom module on systemjs config:

system.config({    'map': {       'custom-marionette': 'path/to/source/custom-marionette',    ...    } } 

then you'll able import custom module inside application:

import marionette 'custom-marionette'; 

Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -