mercadolibre / chico

A collection of easy-to-use UI components.
http://chico.mercadolibre.com
MIT License
342 stars 91 forks source link

Tiny dependecy #1326

Closed escudero89 closed 7 years ago

escudero89 commented 8 years ago

It seems that chico makes use of tiny.js, as it's listed in its dependencies (in package.json).

However, if you use chico.js which appears in the dist folder (without including tiny in your own project), it fails. Such configuration (and requirement) is not explained in the README (or at least, I didn't found any).

Furthermore, what if I don't want tiny on my project (e.g. i am using jquery instead)? It would be awesome if there would be some kind of mechanism which uses tiny or jQuery or whatever available, avoiding forcing onto the user the requirement of using tiny.js.

battaglr commented 7 years ago

Thanks, @escudero89!

However, if you use chico.js which appears in the dist folder (without including tiny in your own project), it fails. Such configuration (and requirement) is not explained in the README (or at least, I didn't found any).

I'll add that to the readme! —added for v2.0.11.

Furthermore, what if I don't want tiny on my project (e.g. i am using jquery instead)? It would be awesome if there would be some kind of mechanism which uses tiny or jQuery or whatever available, avoiding forcing onto the user the requirement of using tiny.js.

That's an interesting idea! I think it would require some analysis first —it will not be added for v2.0.11.

I would like to know if you have any ideas on how to implement that. 😀


My bad closing the issue. 😅

escudero89 commented 7 years ago

No prob.

Regarding the second point, I was thinking something along the lines of:

if (jQuery || $) {
    use_jquery = true;
}

(pseudo-code at its finest)

What could use_jquery mean? Well, we could replace the tiny declaration to use jQuery instead. I think that was what I meant when I wrote that issue back in mid 2016.

Greetings and thanks for the update.

battaglr commented 7 years ago

@escudero89, thanks! I'll check if that's feasible. I think this may help with the transition from v1.x to v2.x.

battaglr commented 7 years ago

@escudero89,

  1. Regarding the confusion about Tiny, I added an explicit reference to "dependencies" in the official website: GettingStarted#Dependencies.

  2. Regarding the ability to switch between jQuery/Tiny as dependency, I don't see that being added since it's not aligned with the project's current objectives. It is a cool idea, thou. :man_dancing: