letsgetrandy / DICSS

Directly injected CSS
http://letsgetrandy.github.io/DICSS/
MIT License
1.35k stars 72 forks source link

putIn can now take JSON argumet; pseudo and "&" selectors can now be a... #10

Closed ghost closed 9 years ago

ghost commented 9 years ago

DICSS.putIn can now take Objects or JSON strings as its first argument. This will allow multiple selectors to be applied within the same call.

var styl = {
    "a": {
        "text-decoration": "none"
    },
    "p": {
        "padding" : "1rem"
    }
};

DICSS.putIn(styl);
// or
DICSS.putIn(JSON.stringify(styl)));

You can also apply pseudo selectors to parents (results in a:hover):

{
    "a": {
        ":hover": {
            ...
        }

And concat parent selectors with & (results in a.active):

{
    "a": {
        "&.active": {
            ...
        }