Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stylecow-plugin-fixes

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylecow-plugin-fixes - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

src/initial.js

1

index.js

@@ -6,2 +6,3 @@ module.exports = function (stylecow) {

require('./src/float')(stylecow);
require('./src/initial')(stylecow);
require('./src/inline-block')(stylecow);

@@ -8,0 +9,0 @@ require('./src/min-height')(stylecow);

2

package.json
{
"name": "stylecow-plugin-fixes",
"description": "Stylecow plugin to fix automatically some css issues.",
"version": "2.0.1",
"version": "3.0.0",
"author": "Oscar Otero <oom@oscarotero.com>",

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

@@ -0,0 +0,0 @@ stylecow plugin fixer

module.exports = function (stylecow) {
//Normalizes the calc function
stylecow.addTask({
filter: {
type: 'Function',
name: 'calc'
},
fn: function (fn) {
var value = fn.shift();
var string = value.toString().replace(/([\w\%])\s*([\+\-])\s*/g, '$1 $2 ');
stylecow.addTask({
"Function": {
calc: function (fn) {
fn[0].replaceWith(fn[0].toString().replace(/([\w\%])\s*([\+\-])\s*/g, '$1 $2 '));
}
fn.unshift(stylecow.Value.createFromString(string));
}
});
};
module.exports = function (stylecow) {
//Add the old syntax of rect()
stylecow.addTask({
disable: {
forBrowsersLowerThan: {
explorer: 8.0
},
"Function": {
rect: function (fn) {
var declaration = fn.parent({type: 'Declaration', name: 'clip'});
filter: {
type: 'Function',
name: 'rect'
},
fn: function (fn) {
var declaration = fn.parent({
type: 'Declaration',
name: 'clip'
});
if (declaration) {
declaration.after('*clip: rect(' + fn.join(' ') + ')');
}
if (declaration) {
declaration.after(stylecow.Declaration.createFromString('*clip: rect(' + fn.join(' ') + ')'));
}

@@ -17,0 +21,0 @@ }

@@ -5,3 +5,3 @@ module.exports = function (stylecow) {

stylecow.addTask({
disable: {
forBrowsersLowerThan: {
chrome: 21.0,

@@ -12,11 +12,14 @@ safari: 6.1,

},
Declaration: function (declaration) {
if (declaration.is({
name: ['break-before', 'break-after', 'break-inside'],
value: 'column'
})) {
declaration.before('-webkit-column-' + declaration.name + ':always');
}
filter: {
type: 'Declaration',
string: [
'break-before: column;',
'break-after: column;',
'break-inside: column;'
]
},
fn: function (declaration) {
declaration.before(stylecow.Declaration.createFromString('-webkit-column-' + declaration.name + ':always'));
}
});
};
module.exports = function (stylecow) {
//Fix the double margin bug in ie6 on float block elements
stylecow.addTask({
disable: {
forBrowsersLowerThan: {
explorer: 7.0
},
Declaration: {
float: function (declaration) {
if (declaration.is({
value: ['left', 'right']
})) {
declaration.after('_display: inline');
}
}
filter: {
type: 'Declaration',
string: [
'float: left;',
'float: right;'
]
},
fn: function (declaration) {
declaration.after(stylecow.Declaration.createFromString('_display: inline'));
}
});
};
module.exports = function (stylecow) {
//Adds support in explorer < 8
stylecow.addTask({
disable: {
forBrowsersLowerThan: {
explorer: 8.0
},
Declaration: {
display: function (declaration) {
if (declaration.is({
value: 'inline-block'
})) {
declaration.after(new stylecow.Declaration('*zoom')).setContent('1');
declaration.after(new stylecow.Declaration('*display')).setContent('inline');
}
}
filter: {
type: 'Declaration',
string: 'display: inline-block;'
},
fn: function (declaration) {
declaration.after(stylecow.Declaration.createFromString('*zoom: 1'));
declaration.after(stylecow.Declaration.createFromString('*display: inline'));
}
});
};
module.exports = function (stylecow) {
//Adds support in explorer < 8
stylecow.addTask({
disable: {
forBrowsersLowerThan: {
explorer: 7.0
},
Declaration: {
'min-height': function (declaration) {
declaration.before('_height:' + declaration.value);
}
filter: {
type: 'Declaration',
name: 'min-height'
},
fn: function (declaration) {
declaration.cloneBefore().name = '_height';
}
});
};
module.exports = function (stylecow) {
//Adds support in explorer < 9
stylecow.addTask({
disable: {
forBrowsersLowerThan: {
explorer: 9.0
},
Declaration: {
opacity: function (declaration) {
var rule = declaration.parent({type: 'Rule'});
filter: {
type: 'Declaration',
name: 'opacity'
},
fn: function (declaration) {
var block = declaration.parent({type: 'Block'});
if (rule) {
rule.addOldMsFilter('alpha(opacity=' + (parseFloat(declaration.value, 10) * 100) + ')');
}
if (block) {
stylecow.utils.addMsFilter(block, 'alpha(opacity=' + (parseFloat(declaration[0], 10) * 100) + ')');
}

@@ -17,0 +18,0 @@ }

module.exports = function (stylecow) {
//Convert two-colon pseudoelements to one-colon for explorer < 9
stylecow.addTask({
disable: {
forBrowsersLowerThan: {
explorer: 9.0
},
Keyword: {
"::after": function (keyword) {
keyword.name = ':after';
},
"::before": function (keyword) {
keyword.name = ':before';
},
"::first-line": function (keyword) {
keyword.name = ':first-line';
},
"::first-letter": function (keyword) {
keyword.name = ':first-letter';
}
filter: {
type: 'Keyword',
name: [
'::after',
'::before',
'::first-line',
'::first-letter'
]
},
fn: function (keyword) {
keyword.name = keyword.name.substr(1);
}
});
};
module.exports = function (stylecow) {
//add ie9 fallback that support vm instead vmin
stylecow.addTask({
disable: {
forBrowsersLowerThan: {
explorer: 10.0
},
Declaration: function (declaration) {
if (declaration.getContent().join(', ').indexOf('vmin') !== -1) {
filter: {
type: 'Declaration'
},
fn: function (declaration) {
if (declaration.toString().indexOf('vmin') !== -1) {
var clone = declaration.cloneBefore();

@@ -19,2 +21,3 @@

});
clone.vendor = 'ms';

@@ -21,0 +24,0 @@ }

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