stylecow-plugin-fixes
Advanced tools
Comparing version 2.0.1 to 3.0.0
@@ -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); |
{ | ||
"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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
10900
14
344
1