Skip to content

Commit

Permalink
feat: add basic cssom addon
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 26, 2018
1 parent 84a002a commit a08dbc9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions addon/cssom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

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

renderer.putRule = function (selector) {
var rawCss = selector + '{}';
var sheet = renderer.sh.sheet;
var index = sheet.insertRule(rawCss, 0);
var rule = (sheet.cssRules || sheet.rules)[index];
var result = {
remove: function () {}
};

result.index = index;
result.rule = rule;
result.style = rule.style;

return result;
};

// renderer.putAtRule = function (prelude) {
// return renderer.putRule(prelude);
// };
};

0 comments on commit a08dbc9

Please sign in to comment.