Socket
Socket
Sign inDemoInstall

stylecow-plugin-custom-media

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylecow-plugin-custom-media - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

tests/cases/combined/ast.json

29

index.js
module.exports = function (stylecow) {
//Save all custom-media in the root
var allCustomMedia = {};
//Reset customMedia variable
stylecow.addTask({
position: 'before',
fn: function (root) {
allCustomMedia = {};
}
});
//Save all custom-media
stylecow.addTask({
filter: {

@@ -10,5 +20,3 @@ type: 'AtRule',

fn: function (customMedia) {
var root = customMedia.getParent('Root');
root.setData('@custom-media-' + customMedia.get('ExtensionName').name, customMedia.get('MediaQueries'));
allCustomMedia[customMedia.get('ExtensionName').name] = customMedia.get('MediaQuery');
customMedia.detach();

@@ -28,6 +36,13 @@ }

.forEach(function (extension) {
var mediaqueries = extension.getData('@custom-media-' + extension.name);
var mediaquery = allCustomMedia[extension.name];
if (mediaqueries) {
extension.getParent('ConditionalExpression').replaceWith(mediaqueries.clone());
if (mediaquery) {
var expression = extension.getParent('ConditionalExpression');
mediaquery.forEach(function (child) {
expression.before(child.clone());
});
expression.detach();
//extension.getParent('ConditionalExpression').replaceWith(mediaqueries.clone());
}

@@ -34,0 +49,0 @@ });

{
"name": "stylecow-plugin-custom-media",
"description": "Stylecow plugin to work with @custom-media",
"version": "1.1.0",
"version": "1.1.1",
"author": "Oscar Otero <oom@oscarotero.com>",

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

@@ -15,29 +15,19 @@ {

{
"class": "MediaQueries",
"class": "ConditionalExpression",
"children": [
{
"class": "MediaQuery",
"class": "ConditionalFeature",
"name": "max-width",
"vendor": null,
"children": [
{
"class": "ConditionalExpression",
"class": "Value",
"children": [
{
"class": "ConditionalFeature",
"name": "max-width",
"vendor": null,
"class": "Unit",
"name": "em",
"children": [
{
"class": "Value",
"children": [
{
"class": "Unit",
"name": "em",
"children": [
{
"class": "Number",
"name": 30
}
]
}
]
"class": "Number",
"name": 30
}

@@ -44,0 +34,0 @@ ]

@@ -15,29 +15,19 @@ {

{
"class": "MediaQueries",
"class": "ConditionalExpression",
"children": [
{
"class": "MediaQuery",
"class": "ConditionalFeature",
"name": "min-width",
"vendor": null,
"children": [
{
"class": "ConditionalExpression",
"class": "Value",
"children": [
{
"class": "ConditionalFeature",
"name": "min-width",
"vendor": null,
"class": "Unit",
"name": "px",
"children": [
{
"class": "Value",
"children": [
{
"class": "Unit",
"name": "px",
"children": [
{
"class": "Number",
"name": 100
}
]
}
]
"class": "Number",
"name": 100
}

@@ -58,29 +48,19 @@ ]

{
"class": "MediaQueries",
"class": "ConditionalExpression",
"children": [
{
"class": "MediaQuery",
"class": "ConditionalFeature",
"name": "max-width",
"vendor": null,
"children": [
{
"class": "ConditionalExpression",
"class": "Value",
"children": [
{
"class": "ConditionalFeature",
"name": "max-width",
"vendor": null,
"class": "Unit",
"name": "px",
"children": [
{
"class": "Value",
"children": [
{
"class": "Unit",
"name": "px",
"children": [
{
"class": "Number",
"name": 1000
}
]
}
]
"class": "Number",
"name": 1000
}

@@ -87,0 +67,0 @@ ]

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