From 5f6e393e33eb0bdb94844389f0afd12205e97c1d Mon Sep 17 00:00:00 2001 From: artico Date: Thu, 14 Mar 2013 12:17:59 +0700 Subject: [PATCH 1/2] Size utility Shorthand for width and height --- lib/nib/index.styl | 1 + lib/nib/size.styl | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 lib/nib/size.styl diff --git a/lib/nib/index.styl b/lib/nib/index.styl index 411e5067..40355fe2 100644 --- a/lib/nib/index.styl +++ b/lib/nib/index.styl @@ -10,3 +10,4 @@ @import 'reset' @import 'text' @import 'vendor' +@import 'size' diff --git a/lib/nib/size.styl b/lib/nib/size.styl new file mode 100644 index 00000000..40108b18 --- /dev/null +++ b/lib/nib/size.styl @@ -0,0 +1,17 @@ +/* + * Size utility. + * + * Synopsis: + * + * size: + * + * Examples: + * + * size: 10px 20px + * size: 100% 30px + * + */ + +size(width, height) + width: width + height: height From e76b7729a21ab7db7840becd39ea93d78bfd63f0 Mon Sep 17 00:00:00 2001 From: artico Date: Thu, 14 Mar 2013 12:30:13 +0700 Subject: [PATCH 2/2] Support only one parameter Making square in this case --- lib/nib/size.styl | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/nib/size.styl b/lib/nib/size.styl index 40108b18..fd3aaf62 100644 --- a/lib/nib/size.styl +++ b/lib/nib/size.styl @@ -3,15 +3,26 @@ * * Synopsis: * - * size: + * size: | * * Examples: * - * size: 10px 20px * size: 100% 30px + * yields: + * width: 100% + * height: 30px + * + * size: 5px + * yields: + * width: 5px + * height: 5px * */ -size(width, height) - width: width - height: height +size() + if length(arguments) == 1 + width: arguments[0] + height: arguments[0] + else + width: arguments[0] + height: arguments[1]