Skip to content

Commit

Permalink
feat: expose selector for addons
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 13, 2018
1 parent c0367ee commit ad64849
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

var hash = require('./hash').hash;
var interpolateSelectors = require('./interpolateSelectors');

var KEBAB_REGEX = /[A-Z]/g;
var isClient = typeof window === 'object';
Expand All @@ -20,6 +19,9 @@ exports.create = function (h) {
hash: function (obj) {
return hash(renderer.stringify(obj));
},
selector: function (parent, selector) {
return parent + ' ' + selector;
},
};

var putRaw;
Expand All @@ -36,15 +38,14 @@ exports.create = function (h) {
}

var put = function (selector, decls) {
var selectors = selector.split(',');
var str = '';
var prop, value;

for (prop in decls) {
value = decls[prop];

if (value instanceof Object) {
var selectorInterpolated = interpolateSelectors(selectors, prop);
var selectorInterpolated = renderer.selector(selector, prop);
put(selectorInterpolated, value);
} else {
str += renderer.decl(prop, value);
Expand Down

0 comments on commit ad64849

Please sign in to comment.