Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins catalog #125

Open
dzek69 opened this issue Dec 15, 2015 · 11 comments
Open

Plugins catalog #125

dzek69 opened this issue Dec 15, 2015 · 11 comments

Comments

@dzek69
Copy link

dzek69 commented Dec 15, 2015

I'd be nice to have some sort of plugins catalog, so users interested would easly find useful stuff to use with Bliss. Switching from jQuery to anything-else requires rewriting a lof of stuff, cause most ready-to-use-browser-stuff-in-javascript requires jQuery to work (I'm rewriting UI in my CMS with Bliss, but I still have to load jQuery, cause of all those plugins).

And with "plugins" I don't mean only some kind of sliders, lightboxes or other-big-things, but also small methods, like the one I wrote yesterday - to temporarily disable the whole form, remembering which inputs was disabled before disabling the form (so they stay disabled after re-enabling the form).

@voxpelli
Copy link

This feels somewhat related to @LeaVerou's earlier issue here: h5bp/lazyweb-requests#178

That issue resulted in eg: http://youmightnotneedjqueryplugins.com/

Another vanilla-js plugin site that was mentioned there was: http://microjs.com/

For most things those sites would probably serve the purpose well. Perhaps there's a use case for some Bliss-specific things as well, but since the purpose of Bliss is to make vanilla js-simpler it feels weird to make non-vanilla js plugins that only work with Bliss and if the plugins are vanilla then those existing sites and the references issue would solve this fairly well I think.

@dperrymorrow
Copy link
Collaborator

One thing i really like about bliss is that it adds functions that are as convenient as prototype extensions but yet much less intrusive by defining _ on arrays and elements.

plugins / extensions to bliss could be as simple as a way to define _ on other native objects.
for example:

"my string"._.capitalize();
// My String

then there could be a bliss extension libs organized by object type, String, Date, Number ect..

@LeaVerou
Copy link
Owner

That’s a great idea @dperrymorrow! Love it!!

@LeaVerou
Copy link
Owner

In general, we should have a list of “official” plugins, like we do in Prism. These end up getting more contributions from the community so are more polished than random plugins people post on their website or StackOverflow.
However, that means adding at least one more page to the website, so I do need to figure out some templating solution. Maybe I'll extend transform.js to accept URIs, that'd be pretty cool :)

@nevf
Copy link

nevf commented Feb 25, 2016

+1 for the Plugins page. Just having it on Github would be a good start. And like @dperrymorrow the win is to have plugins accessible via. _ on elements etc.

Also a short boilerplate example of writing a plugin using $.add() would be nice.

@LeaVerou
Copy link
Owner

Short example I actually have in my current Bliss-powered work project:

// Add or remove a CSS class based on whether the second param is truthy or falsy.
$.add("toggleClass", function(className, addIf) {
    this.classList[addIf? "add" : "remove"](className);
});

// Provide shortcuts to long property chains in class definitions
$.proxy = $.classProps.proxy = $.overload(function(obj, property, proxy) {
    Object.defineProperty(obj, property, {
        get: function() {
            return this[proxy][property];
        },
        configurable: true,
        enumerable: true
    });

    return obj;
});

@nevf
Copy link

nevf commented Feb 25, 2016

@LeaVerou Thanks, very helpful. However $.overload() isn't documented and $.classProps is only touched upon. ;-)

@LeaVerou
Copy link
Owner

$.overload() is not crucial here, it just saves you from having to handle two signatures of the function, one with an object of key-value pairs and one with 2 arguments (one key and one value).

@dperrymorrow could you please add some documentation for $.overload()? (I do remember correctly that you wrote it, right? If not, sorry!) Even a stub with a 1 line description would be something.

@dperrymorrow
Copy link
Collaborator

sure thing @LeaVerou will try to get to that today.

@dperrymorrow
Copy link
Collaborator

added documentation,
eb0948b
http://blissfuljs.com/docs.html#fn-overload

@LeaVerou
Copy link
Owner

LeaVerou commented Mar 4, 2016

Fantastic, thanks!!

It might be good to have 2 keys in the object example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants