ractivejs / ractive-load

Import templates and components using AJAX
ractivejs.github.io/ractive-load
MIT License
55 stars 10 forks source link

ractive-load.js not working when testing out your ractive-load js samples #32

Open awongCM opened 8 years ago

awongCM commented 8 years ago

Hi,

I'm trying to learn and test out one of your code samples of using ractive-load plugin.

http://examples.ractivejs.org/donut-charts

I reproduced all the code on my local machine, ran python simpleHTTPserver as my own webserver, etc.

When I tried to viewing it in my web browser, i got following errors in the console log.

Uncaught (in promise) Error: Ractive.load() error: Could not find dependency "ractive-transitions-fade". It should be exposed as Ractive.load.modules["ractive-transitions-fade"] or window["ractive-transitions-fade"

Why is it complaining about the promises? Is it because I'm using a different web server than Node/Express?

In my JS code, I simply wrote code like this(as per your existing samples)

Ractive.load('BaseView.html').then(function (BaseView) {
   var ractive = new BaseView({
      el: 'main',
      data: getData()
    });  
});

function getData () {
  return {
    months: [
      { name: 'January',   points: { dogs: 4, cats: 3, rabbits: 7 } },
      { name: 'February',  points: { dogs: 2, cats: 7, rabbits: 3 } },
      { name: 'March',     points: { dogs: 5, cats: 4, rabbits: 6 } },
      { name: 'April',     points: { dogs: 6, cats: 8, rabbits: 4 } },
      { name: 'May',       points: { dogs: 8, cats: 9, rabbits: 5 } },
      { name: 'June',      points: { dogs: 3, cats: 2, rabbits: 2 } },
      { name: 'July',      points: { dogs: 4, cats: 4, rabbits: 8 } },
      { name: 'August',    points: { dogs: 2, cats: 5, rabbits: 9 } },
      { name: 'September', points: { dogs: 3, cats: 6, rabbits: 4 } },
      { name: 'October',   points: { dogs: 7, cats: 2, rabbits: 7 } },
      { name: 'November',  points: { dogs: 5, cats: 8, rabbits: 5 } },
      { name: 'December',  points: { dogs: 1, cats: 0, rabbits: 7 } }
    ]
  };
}
fskreuz commented 8 years ago

error: Could not find dependency "ractive-transitions-fade"

Check if that plugin exists, or is even loaded by the browser.

awongCM commented 8 years ago

No. It doesn't.

awongCM commented 8 years ago

Hi. Did you get my response?

Madgvox commented 8 years ago

Your problem is that ractive-load couldn't find the ractive-transitions-fade plugin. You need to either remove that dependency from the snippet or load it as well in a way that ractive-load can find. Here is the section of the readme that describes how that works.

awongCM commented 8 years ago

Okay. Thanks.

I'll check out the readme section as soon as I have time to look at it.

Will let you know how it goes.

Cheers.