Socket
Socket
Sign inDemoInstall

stylecow-plugin-nested-rules

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylecow-plugin-nested-rules - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

49

index.js

@@ -8,15 +8,2 @@ module.exports = function (stylecow) {

fn: function (parentRule) {
// resolve nested @media
parentRule
.firstChild({type: 'Block'})
.children({
type: 'AtRule',
name: 'media'
})
.forEach(function (media) {
nestedMedia(parentRule, media);
});
// resolve nested rules
var index = parentRule.index();

@@ -27,6 +14,16 @@ var offset = 1;

.firstChild({type: 'Block'})
.children('Rule')
.children()
.forEach(function (child) {
nestedRule(parentRule, child, index + offset);
++offset;
// resolve nested @media
if (child.type === 'AtRule' && child.name === 'media') {
nestedMedia(parentRule, child, index + offset);
++offset;
}
// resolve nested rules
else if (child.type === 'Rule') {
nestedRule(parentRule, child, index + offset);
++offset;
}
});

@@ -40,3 +37,3 @@

function nestedMedia(parentRule, media) {
function nestedMedia(parentRule, media, parentRuleIndex) {
var rule = new stylecow.Rule();

@@ -52,3 +49,19 @@

parentRule.after(media);
var index = rule.index();
var offset = 1;
rule
.firstChild({type: 'Block'})
.children('Rule')
.forEach(function (child) {
nestedRule(rule, child, index + offset);
++offset;
});
if (rule.firstChild('Block').length === 0) {
rule.remove();
}
parentRule.parent().splice(parentRuleIndex, 0, media);
}

@@ -55,0 +68,0 @@

{
"name": "stylecow-plugin-nested-rules",
"description": "Stylecow plugin to add support for nested rules.",
"version": "3.2.0",
"version": "3.2.1",
"author": "Oscar Otero <oom@oscarotero.com>",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/stylecow/stylecow-plugin-nested-rules",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc