stylecow-plugin-flex
Advanced tools
Comparing version 3.0.1 to 4.0.0
{ | ||
"name": "stylecow-plugin-flex", | ||
"description": "Stylecow plugin to add vendor prefixes and create fallback in browsers supporting the old flexbox syntax", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"author": "Oscar Otero <oom@oscarotero.com>", | ||
@@ -13,6 +13,6 @@ "homepage": "https://github.com/stylecow/stylecow-plugin-flex", | ||
"scripts": { | ||
"test": "node tests/index.js" | ||
"test": "mocha tests/cases.js" | ||
}, | ||
"devDependencies": { | ||
"stylecow": "*" | ||
"stylecow": "6.*" | ||
}, | ||
@@ -19,0 +19,0 @@ "main": "index.js", |
@@ -23,3 +23,4 @@ module.exports = function (stylecow) { | ||
//display: flex/inline-flex => display: -ms-flexbox/-ms-inline-flexbox | ||
// from display: flex/inline-flex | ||
// to display: -ms-flexbox/-ms-inline-flexbox | ||
stylecow.addTask({ | ||
@@ -36,3 +37,3 @@ filter: { | ||
.cloneBefore() | ||
.search({ | ||
.getAll({ | ||
type: 'Keyword', | ||
@@ -42,3 +43,4 @@ name: ['flex', 'inline-flex'] | ||
.forEach(function (keyword) { | ||
keyword.name = '-ms-' + keyword.name + 'box'; | ||
keyword.name += 'box'; | ||
keyword.vendor = 'ms'; | ||
}); | ||
@@ -48,3 +50,2 @@ } | ||
//name/value replacements | ||
@@ -54,3 +55,4 @@ stylecow.addTask({ | ||
type: 'Declaration', | ||
name: Object.keys(names) | ||
name: Object.keys(names), | ||
vendor: false | ||
}, | ||
@@ -60,4 +62,4 @@ fn: function (declaration) { | ||
.cloneBefore() | ||
.set('name', names[declaration.name]) | ||
.search({ | ||
.setName(names[declaration.name]) | ||
.getAll({ | ||
type: 'Keyword', | ||
@@ -72,3 +74,2 @@ name: Object.keys(values) | ||
//Other vendor prefixes | ||
@@ -78,7 +79,10 @@ stylecow.addTask({ | ||
type: 'Declaration', | ||
name: /^flex/ | ||
name: /^flex/, | ||
vendor: false | ||
}, | ||
fn: function (declaration) { | ||
if (!names[declaration.name]) { | ||
return declaration.cloneBefore().name = '-ms-' + declaration.name; | ||
declaration | ||
.cloneBefore() | ||
.setVendor('ms'); | ||
} | ||
@@ -85,0 +89,0 @@ } |
@@ -33,3 +33,3 @@ module.exports = function (stylecow) { | ||
.cloneBefore() | ||
.search({ | ||
.getAll({ | ||
type: 'Keyword', | ||
@@ -39,3 +39,4 @@ name: ['flex', 'inline-flex'] | ||
.forEach(function (keyword) { | ||
keyword.name = '-webkit-' + keyword.name.replace('flex', 'box'); | ||
keyword.name = keyword.name.replace('flex', 'box'); | ||
keyword.vendor = 'webkit'; | ||
}); | ||
@@ -65,3 +66,3 @@ } | ||
fn: function (declaration) { | ||
var value = declaration[0]; | ||
var value = declaration.get('Value'); | ||
@@ -86,3 +87,3 @@ if (value[0]) { //flex-direction | ||
fn: function (declaration) { | ||
var value = declaration[0]; | ||
var value = declaration.get('Value'); | ||
@@ -96,3 +97,3 @@ if (value[0]) { //flex-grow | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-flex: ' + value[0])); | ||
declaration.before(stylecow.parse('-webkit-box-flex: ' + value[0], 'Declaration')); | ||
} | ||
@@ -124,3 +125,3 @@ } | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-ordinal-group: ' + value)); | ||
declaration.before(stylecow.parse('-webkit-box-ordinal-group: ' + value, 'Declaration')); | ||
} | ||
@@ -139,4 +140,4 @@ }); | ||
.cloneBefore() | ||
.set('name', names[declaration.name]) | ||
.search({ | ||
.setName(names[declaration.name]) | ||
.getAll({ | ||
type: 'Keyword', | ||
@@ -155,12 +156,12 @@ name: Object.keys(values) | ||
case 'wrap': | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-lines: multiple')); | ||
declaration.before(stylecow.parse('-webkit-box-lines: multiple', 'Declaration')); | ||
break; | ||
case 'nowrap': | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-lines: single')); | ||
declaration.before(stylecow.parse('-webkit-box-lines: single', 'Declaration')); | ||
break; | ||
case 'wrap-reverse': | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-lines: multiple')); | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-direction: reverse')); | ||
declaration.before(stylecow.parse('-webkit-box-lines: multiple', 'Declaration')); | ||
declaration.before(stylecow.parse('-webkit-box-direction: reverse', 'Declaration')); | ||
break; | ||
@@ -173,17 +174,17 @@ } | ||
case 'row': | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-orient: horizontal')); | ||
declaration.before(stylecow.parse('-webkit-box-orient: horizontal', 'Declaration')); | ||
break; | ||
case 'row-reverse': | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-orient: horizontal')); | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-direction: reverse')); | ||
declaration.before(stylecow.parse('-webkit-box-orient: horizontal', 'Declaration')); | ||
declaration.before(stylecow.parse('-webkit-box-direction: reverse', 'Declaration')); | ||
break; | ||
case 'column': | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-orient: vertical')); | ||
declaration.before(stylecow.parse('-webkit-box-orient: vertical', 'Declaration')); | ||
break; | ||
case 'column-reverse': | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-orient: vertical')); | ||
declaration.before(stylecow.Declaration.createFromString('-webkit-box-direction: reverse')); | ||
declaration.before(stylecow.parse('-webkit-box-orient: vertical', 'Declaration')); | ||
declaration.before(stylecow.parse('-webkit-box-direction: reverse', 'Declaration')); | ||
break; | ||
@@ -190,0 +191,0 @@ } |
@@ -22,9 +22,7 @@ module.exports = function (stylecow) { | ||
.cloneBefore() | ||
.search({ | ||
.get({ | ||
type: 'Keyword', | ||
name: ['flex', 'inline-flex'] | ||
}) | ||
.forEach(function (keyword) { | ||
keyword.name = '-webkit-' + keyword.name; | ||
}); | ||
.setVendor('webkit'); | ||
} | ||
@@ -38,6 +36,9 @@ }); | ||
type: 'Declaration', | ||
name: /^(flex.*|align.*|justify-content|order)$/ | ||
name: /^(flex.*|align.*|justify-content|order)$/, | ||
vendor: false | ||
}, | ||
fn: function (declaration) { | ||
declaration.cloneBefore().name = '-webkit-' + declaration.name; | ||
declaration | ||
.cloneBefore() | ||
.setVendor('webkit'); | ||
} | ||
@@ -44,0 +45,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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
21467
12
737
0
1