MightyMedia / Simple-Social-Share

Simple Social Share is a simple way of creating social share buttons on your website.
MIT License
5 stars 2 forks source link

Make the jQuery version a wrapper for the VanillaJS version #7

Open basvandenwijngaard opened 4 years ago

basvandenwijngaard commented 4 years ago

At this moment the jQuery version is a standalone plugin. This should be a wrapper for the VanillaJS version, so that we only have to maintain 1 codebase.

Ryuno-Ki commented 4 years ago

Hey @basvandenwijngaard,

since I already worked on Share-Backported I'd like to pick this issue up. Can you assign it to me?

If I get that right, you are editing two files at the moment and generate the minified files using Gulp.

When the jQuery plugin wraps the VanillaJS one, what shall happen to the globals registered by the Vanilla JS?

basvandenwijngaard commented 4 years ago

Hey @Ryuno-Ki ,

I haven't really given it much thought yet about a possible solution. This issue was sort of a reminder for myself. I haven't decided if the jQuery plugin should really wrap the VanillaJS one, or should have it's own functions that just use the VanillaJS's functions (I was kind of leaning this way).

Simple Social Share started out as a jQuery plugin and later a rewrote is in plain Javascript because I myself try not to use jQuery for every little thing.

The jQuery version could be just a quite basic plugin that needs the VanillaJS one to be able to work. When compiling to the minified jQuery version we could just include the VanillaJS one in the same file.

The main objective is to not have 2 versions of Simple Social Share that are basically duplicates of each other. In a maintainable solution. With 1 requirement (which I should maybe have mentioned earlier) that I want it to work without ES6, to keep it compatible with old codebases.

So if you have good idea's how this is done in the nicest way, feel free to do it that way.

Ryuno-Ki commented 4 years ago

Hm, I haven't worked with Gulp in a while. Personally I'm using rollup to generate multiple outputs if needed.

Then, I can write the source code with ES6+ and let Rollup generate ES5 (e.g. IIFE, UMD) and ES modules. Plus, the result is smaller as, say, webpack!

You said, you haven't made up your mind. I interpret this, as this issue is not ready to be worked on just yet, but should rather be used to discuss possible approaches.

basvandenwijngaard commented 4 years ago

You said, you haven't made up your mind. I interpret this, as this issue is not ready to be worked on just yet, but should rather be used to discuss possible approaches.

I think you interpretation is correct. I have make up my mind what kind of solution/direction I want for this while keeping my codebase & tooling as simple as possible (which at his moment I think is the current Gulp setup). So maybe for now it's better to put this issue on hold.