Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Blueprint for vendoring, no tests ATM, theyll come soon

  • Loading branch information...
commit 3d57d9bf204515e560007cc1383cf9a88898a326 1 parent 7978531
@kizu kizu authored slang800 committed
Showing with 18 additions and 7 deletions.
  1. +1 −1  lib/nib.js
  2. +1 −1  lib/nib/vendor.styl
  3. +16 −5 lib/nodes/vendor-helpers.js
View
2  lib/nib.js
@@ -67,6 +67,6 @@ function plugin() {
style.define('has-canvas', nodes.false);
}
- style.define('gradients-syntax-fix', vendorHelpers);
+ style.define('vendorize', vendorHelpers);
}
}
View
2  lib/nib/vendor.styl
@@ -106,7 +106,7 @@ vendor(prop, args, only = null, ignore = null, vendor-property = true)
newprop = '-' + prefix + '-' + prop if vendor-property
// TODO: make the adjustments for differences
// between the official syntax and vendor ones
- {newprop}: newargs
+ {newprop}: vendorize(newargs)
/*
* Vendorize the given value.
View
21 lib/nodes/vendor-helpers.js
@@ -8,13 +8,24 @@ var stylus = require('stylus')
, utils = stylus.utils
/**
- * Expose `gradients-syntax-fix`.
+ * Expose `vendorize`.
*/
module.exports = function(value) {
- if (value) {
- return 'Hello ' + value.toString().toUpperCase()
- } else {
- return 'Hello World'
+ var result = value.toString();
+
+ if (result.indexOf('gradient(') > -1) {
+ result = result.replace(/(\(\s*)(?:(-?(\d*\.)?\d+)deg|to (top|bottom|left|right))/g,function(match,p1,p2,p3,p4){
+ var result = p1;
+ if (p2) {
+ result += parseFloat((Math.abs(450 - p2) % 360).toFixed(3)) + 'deg';
+ }
+ if (p4) {
+ result += {'top':'bottom','bottom':'top','left':'right','right':'left'}[p4];
+ }
+ return result;
+ });
}
+
+ return new nodes.Ident(result);
}
Please sign in to comment.
Something went wrong with that request. Please try again.