cferdinandi / tabby

Lightweight, accessible vanilla JS toggle tabs.
MIT License
598 stars 73 forks source link

Add ES6 module #109

Closed sntran closed 5 years ago

sntran commented 5 years ago

I have been using ES6 modules in browser. It would be nice if Tabby is written as ES6 module so I could import into my main module to use.

Example usage:

index.html

<script type="module" src="/js/app.mjs"></script>

app.mjs

import Tabby from "../node_modules/tabbyjs/dist/tabby.esm.js";

const tabs = new Tabby(`[data-tabs]`);
cferdinandi commented 5 years ago

This would require a rewrite of Tabby, and I'm not keen on doing that at this time. Additionally, many of my users still load this the old fashioned way with a script element (myself included), so that would need to be preserved as well.

Doing so would involve adding another build layer to create separate files for the different approaches, and as free software that I maintain in my spare time, I'm not ready to make that kind of commitment yet.

Sorry! :(

sntran commented 5 years ago

Would you take a PR for this then?

cferdinandi commented 5 years ago

I'm not sure how substantial the changes to the code base would have to be. Even with a PR, I'm ultimately on the hook to maintain it.

mrleblanc101 commented 1 year ago

I was able to do import Tabby from 'tabbyjs'; without issue.