stylecow-plugin-nested-rules
Advanced tools
Comparing version 1.0.2 to 1.0.3
27
index.js
@@ -10,11 +10,28 @@ module.exports = function (stylecow) { | ||
var space = ' '; | ||
var prepend = false; | ||
if (childSelector.name[0] === '&') { | ||
childSelector.name = childSelector.name.substr(1); | ||
childSelector[0].name = childSelector[0].name.substr(1); | ||
space = ''; | ||
if (/^\w/.test(childSelector[0].name)) { | ||
prepend = true; | ||
} | ||
} | ||
ruleSelectors.forEach(function (ruleSelector) { | ||
var selector = stylecow.css.Selector.create(ruleSelector.name + space + childSelector.name); | ||
child.add(selector); | ||
var code; | ||
if (prepend) { | ||
var content = ruleSelector.content; | ||
code = content.slice(0, -1); | ||
code.push(childSelector[0].name); | ||
code.push(content.slice(-1)); | ||
code = code.concat(childSelector.slice(1)).join(''); | ||
} else { | ||
code = ruleSelector.name + space + childSelector.name; | ||
} | ||
child.add(stylecow.css.Selector.create(code)); | ||
}); | ||
@@ -27,4 +44,8 @@ | ||
}); | ||
if (rule.children('Selector').length === rule.length) { | ||
rule.remove(); | ||
} | ||
} | ||
} | ||
}; |
{ | ||
"name": "stylecow-plugin-nested-rules", | ||
"description": "Stylecow plugin to add support for nested rules.", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"author": "Oscar Otero <oom@oscarotero.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/stylecow/stylecow-plugin-nested-rules", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4790
10
103