Skip to content
Browse files

Changed the vendor plugin to be used in .styl, so literal nib import …

…would work
  • Loading branch information...
1 parent ab02a97 commit 81b31820fcb5eb0ee78189b1433e1343e9f95c02 @kizu kizu committed with slang800
Showing with 15 additions and 18 deletions.
  1. +0 −4 lib/nib.js
  2. +3 −2 lib/nib/vendor.styl
  3. +11 −11 lib/nodes/vendor-helpers.js
  4. +1 −1 package.json
View
4 lib/nib.js
@@ -27,8 +27,6 @@ try {
// ignore
}
-var vendorHelpers = require('./nodes/vendor-helpers')
-
/**
* Library version.
*/
@@ -66,7 +64,5 @@ function plugin() {
} else {
style.define('has-canvas', nodes.false);
}
-
- style.define('normalize', vendorHelpers);
}
}
View
5 lib/nib/vendor.styl
@@ -1,3 +1,4 @@
+use('../nodes/vendor-helpers.js')
@import 'config'
/*
@@ -504,13 +505,13 @@ border-radius()
* // The comma is important
* .placeholder-red
* placeholder(color red,)
- *
+ *
* // We can pass a function
* green-placeholder()
* color green
* .placeholder-green
* placeholder(green-placeholder)
- *
+ *
* // We can pass a hash
* textarea
* placeholder((font-style italic) (font-weight bold) (padding '4px 10px'))
View
22 lib/nodes/vendor-helpers.js
@@ -1,11 +1,3 @@
-
-/**
- * Module dependencies.
- */
-
-var stylus = require('stylus')
- , nodes = stylus.nodes;
-
var RE_GRADIENT_STOPS = /([\(\,]\s*)(-?(?:\d*\.)?\d+(?:%|px|em))(\s+)((hsl|rgb)a?\([^\)]+\)|#[^\)\,]+)/g
, RE_GRADIENT_VAL = /(\(\s*)(?:(-?(\d*\.)?\d+)deg|((to )?(top|bottom|left|right)( (top|bottom|left|right))?))/g
, RE_GRADIENT_TYPE = /((repeating-)?(linear|radial)-gradient\()/g
@@ -18,8 +10,6 @@ var DIRECTIONS = { top: 'bottom', bottom: 'top', left: 'right', right:'left' };
* Expose `normalize`.
*/
-exports = module.exports = normalize;
-
function normalize(property, value, prefix){
var result = value.toString()
, args;
@@ -50,7 +40,7 @@ function normalize(property, value, prefix){
result = result.replace(RE_FILL_KEYWORD, ' ');
}
- return new nodes.Ident(result);
+ return result;
}
function normalizeGradient(parts, prefix){
@@ -73,3 +63,13 @@ function normalizeGradient(parts, prefix){
return val;
}
+
+var plugin = function(){
+ return function(style){
+ var nodes = this.nodes;
+ style.define('normalize', function(property, value, prefix) {
+ return new nodes.Ident(normalize(property, value, prefix));
+ });
+ };
+};
+module.exports = plugin;
View
2 package.json
@@ -7,7 +7,7 @@
"url": "git://github.com/visionmedia/nib.git"
},
"dependencies": {
- "stylus": "0.31.x"
+ "stylus": "0.34.x"
},
"devDependencies": {
"connect": "1.x",

0 comments on commit 81b3182

Please sign in to comment.
Something went wrong with that request. Please try again.