These are chat archives for ractivejs/ractive

Jul 2018
Jul 05 2018 15:44
@ceremcem i haven't looked into it. I'm also lacking in the politics department. :grin:
Nice to know Ractive is being used in these kinds apps. This joins the other politics-related apps powered by Ractive, notably The Guardian's 2016 US election map.
In other news, a new toolkit has been linked on the docs site!
Jul 05 2018 15:46
Cerem Cem ASLAN
Jul 05 2018 20:37
Shakeel Osmani
Jul 05 2018 20:50
I have a question I see till upto RactiveJS vs .8 there were individuals who wrote plugins and components and made them available as node modules. Is this still possible. Is there an example I can follow and publish some of the components that I have been writing and that use popular 3rd party libraries. It will benefit those who need those libraries integrated also I am a newbie and community can refactor the code or provide comments to make them better.
Chris Reeves
Jul 05 2018 21:12
It's definitely still possible, and there's even a generic plugin format now available via use. It's a bit under documented at the moment though. It's a bit harder to publish modules with all of the different formats these days, especially with those formats that don't support declarative dependencies. The use-style plugins aim to mitigate that a bit, as they supply the Ractive lib to the plugin function.
Shakeel Osmani
Jul 05 2018 21:16
@evs-chris for example i have a select to component here select2 . How the use-style plugin play a role here in making it available as a lib
Chris Reeves
Jul 05 2018 21:52
in the case of third-party integrations, there's not really a great way to publish those as modules unless you are targeting a specific module system(s)
it's challenging to cover all of the cases nicely, and in this case, you need jquery and a plugin already in place before your ractive plugin can be loaded
at this point, my approach has been to support es6 with a bundler and pseudo umd, where the deps (jquery and the plugin) are provided to the plugin function exported by my module
so you get something like this:
export default plugin(opts) {
  const extend = {
    template: '...',
    on: { init() { ... }, ... },
  return function({ Ractive, target }) {
    target.components[ || 'mycomponent'] = Ractive.extend(extend);
Chris Reeves
Jul 05 2018 21:59
which is then used
import mycomponent from 'wherever';
new Ractive({ use: [mycomponent({ name: 'somename', jquery, .... })] });

ideally the module would be able to declare its deps up from with plain old

import jquery from 'jquery';

and the like, but in practice, that cuts out a pretty big chunk of the web that is just throwing stuff into a <script> tag

Shakeel Osmani
Jul 05 2018 22:06
Understood. So for sometime to come having these in github is good enough, and if people search for it they will find it.