Skip to content

Commit

Permalink
Related to #91
Browse files Browse the repository at this point in the history
  • Loading branch information
jazblueful committed Jun 20, 2014
1 parent 6b7f627 commit be3c8fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/api/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ module.exports = function(API) {
props = toRegister[i].props,
allRules = API.getRules(stylesheet);
var pc = options && options.preventCombining ? '|' + options.preventCombining.join('|') : '';
var uid = pc.indexOf('|' + selector.replace(/^%(.*)?%/, '')) >= 0 ? '~~' + (selector.match(/^%(.*)?%/) ? API.numOfAddedRules++ : API.numOfAddedRules) + '~~' : '';
var uid = pc.indexOf('|' + selector.replace(/^%.*?%/, '')) >= 0 ? '~~' + (selector.match(/^%.*?%/) ? API.numOfAddedRules++ : API.numOfAddedRules) + '~~' : '';
// overwrite already added value
var current = allRules[uid + selector] || {};
for(var propNew in props) {
Expand Down
6 changes: 3 additions & 3 deletions lib/processors/css/CSS.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ var toCSS = function(rules, options, indent) {
css += rules[selector][selector] + newline;
// handling normal styles
} else {
var entityStyle = indent[0] + selector.replace(/~~(.+)~~/, '').replace(/^%(.*)?%/, '') + ' {' + newline;
var entityStyle = indent[0] + selector.replace(/~~(.+)~~/, '').replace(/^%.*?%/, '') + ' {' + newline;
var entity = '';
for(var prop in rules[selector]) {
var value = rules[selector][prop];
if(value === "") {
value = '""';
}
prop = prop.replace(/~~(.+)~~/, '').replace(/^%(.*)+?%/, '');
prop = prop.replace(/~~(.+)~~/, '').replace(/^%.*?%/, '');
if(options && options.keepCamelCase === true) {
entity += indent[1] + prop + ': ' + value + ';' + newline;
} else {
Expand Down Expand Up @@ -90,7 +90,7 @@ var combineSelectors = function(rules, preventCombining) {
if(map[i].combine === true && map[i].selector !== false) {
for(var j=i+1;j<map.length; j++) {
if(map[i].prop === map[j].prop && map[i].value === map[j].value) {
map[i].selector += ', ' + map[j].selector.replace(/~~(.+)~~/, '').replace(/^%(.*)+?%/, '');
map[i].selector += ', ' + map[j].selector.replace(/~~(.+)~~/, '').replace(/^%.*?%/, '');
map[j].selector = false; // marking for removal
}
}
Expand Down

0 comments on commit be3c8fb

Please sign in to comment.