Skip to content

Commit

Permalink
feat: implement drule()
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 14, 2018
1 parent cd3dcc7 commit 31ee8a2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

[![][npm-badge]][npm-url] [![][travis-badge]][travis-url]

Super lite CSS-in-JS solution.
Super lite CSS-in-JS solution at only __0.XKb__ packing more features than you will find in any other CSS-in-JS library.

- Only __0.XKb__ minified and gzipped.
- Library agnostic
- Use with any virtual DOM library, not just React.
- Isomorphic — render on server and browser.
- Does not create wrapper components.


Expand Down
23 changes: 23 additions & 0 deletions addon/drule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

exports.addon = function (renderer) {
if (process.env.NODE_ENV !== 'production') {
require('./__dev__/warnOnMissingDependencies')('drule', renderer, ['rule']);
}

renderer.drule = function (styles, block) {
var className = renderer.rule(styles, block);

var closure = function (dynamicStyles) {
var dynamicClassName = renderer.cache(dynamicStyles);

return className + dynamicClassName;
};

closure.toString = function () {
return className;
};

return closure;
};
};

0 comments on commit 31ee8a2

Please sign in to comment.