Skip to content

Commit

Permalink
Merge pull request #195 from visionmedia/stuff
Browse files Browse the repository at this point in the history
relatively small amount of stuff
  • Loading branch information
notslang committed Jun 19, 2013
2 parents e22a005 + 3920daa commit 383bcf9
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 73 deletions.
Empty file removed .gitmodules
Empty file.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- 0.8
11 changes: 0 additions & 11 deletions Makefile

This file was deleted.

2 changes: 2 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/visionmedia/nib.png?branch=master)](https://travis-ci.org/visionmedia/nib)

# Nib

Stylus mixins, utilities, components, and gradient image generation. Don't forget to check out the [documentation](http://visionmedia.github.com/nib/).
Expand Down
18 changes: 9 additions & 9 deletions lib/nib/gradients.styl
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ pos-in-stops(i, stops)
else if i
unit(i / len * 100, '%')
else
0%
0

/*
* Normalize color stops:
*
*
* - (color pos) -> (pos color)
* - (color) -> (implied-pos color)
*
*
*/

normalize-stops(stops)
Expand Down Expand Up @@ -88,19 +88,19 @@ webkit-stop(color, pos)
*/

std-stop(color, pos)
'%s %s' % (color pos)
'%s %s' % (color pos)

/*
* Create a linear gradient with the given start position
* and variable number of color stops.
*
*
* Examples:
*
*
* background: linear-gradient(top, red, green, blue)
* background: linear-gradient(bottom, red, green 50%, blue)
* background: linear-gradient(bottom, red, 50% green, blue)
* background: linear-gradient(bottom, red, 50% green, 90% white, blue)
*
*
*/

linear-gradient(start, stops...)
Expand Down Expand Up @@ -130,10 +130,10 @@ linear-gradient(start, stops...)
stops = join-stops(stops, std-stop)
for prefix in vendor-prefixes
unless prefix == official
gradient = '-%s-linear-gradient(%s, %s)' % (prefix start stops)
gradient = '-%s-linear-gradient(%s, %s)' % (prefix start stops)
add-property(prop, replace(val, '__CALL__', gradient))

// standard
// standard
'linear-gradient(%s, %s)' % (start stops)

/*
Expand Down
20 changes: 15 additions & 5 deletions lib/nib/image.styl
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@

/*
* Define background-image as `path`
* with optional width and height,
* adding an @2x variant.
* Define background-image as `path` with optional width and height, adding an
* @2x variant.
*
* affected by github.com/LearnBoost/stylus/issues/1050 and
* github.com/LearnBoost/stylus/issues/1038 ... refactor when those are closed
*/

image(path, w = auto, h = auto)
image(path, w = auto, h = auto, min_pixel_ratio = 1.5)
background-image: url(path)
@media all and (-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5)

s = 'all and (-webkit-min-device-pixel-ratio:' + min_pixel_ratio + '),'
s = s + '(min--moz-device-pixel-ratio:' + min_pixel_ratio + '),'
s = s + '(-o-min-device-pixel-ratio:' + min_pixel_ratio + '/1),'
s = s + '(min-device-pixel-ratio:' + min_pixel_ratio + '),'
s = s + '(min-resolution:' + unit(min_pixel_ratio*92, dpi) + '),'
s = s + '(min-resolution:' + unit(min_pixel_ratio, dppx) + ')'

@media s
ext = extname(path)
path = pathjoin(dirname(path), basename(path, ext) + '@2x' + ext)
background-image: url(path)
Expand Down
4 changes: 2 additions & 2 deletions lib/nib/vendor.styl
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ opacity(n, args...)
-ms-filter: none
filter: none
else
filter: 'alpha(opacity=%s)' % val args
-ms-filter: '"progid:DXImageTransform.Microsoft.Alpha(Opacity=%s)"' % val args
filter: 'alpha(opacity=%s)' % val args

/*
* Vendor "text-size-adjust"
Expand Down Expand Up @@ -472,7 +472,7 @@ appearance()
*/

tab-size()
vendor('tab-size', arguments, only: moz o)
vendor('tab-size', arguments, only: moz o official)

/*
* Vendor "overflow-scrolling" support.
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
"devDependencies": {
"connect": "1.x"
, "jade": "0.22.0"
, "stylus": "0.28.x"
, "stylus": "0.31.x"
, "mocha": "*"
, "should": "*"
, "canvas": "*"
},
"author": "TJ Holowaychuk <[email protected]>",
"main": "lib/nib.js",
"engines": { "node": "*" }
"engines": { "node": "*" },
"scripts": {
"test": "mocha",
"test-server": "node test/server.js"
}
}
4 changes: 2 additions & 2 deletions test/cases/image.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#logo {
background-image: url("/images/branding/logo.main.png");
}
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
@media all and (-webkit-min-device-pixel-ratio:1.5),(min--moz-device-pixel-ratio:1.5),(-o-min-device-pixel-ratio:1.5/1),(min-device-pixel-ratio:1.5),(min-resolution:138dpi),(min-resolution:1.5dppx) {
#logo {
background-image: url("/images/branding/[email protected]");
background-size: auto auto;
Expand All @@ -10,7 +10,7 @@
#logo {
background-image: url("/images/branding/logo.main.png");
}
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
@media all and (-webkit-min-device-pixel-ratio:1.5),(min--moz-device-pixel-ratio:1.5),(-o-min-device-pixel-ratio:1.5/1),(min-device-pixel-ratio:1.5),(min-resolution:138dpi),(min-resolution:1.5dppx) {
#logo {
background-image: url("/images/branding/[email protected]");
background-size: 50px 100px;
Expand Down
1 change: 0 additions & 1 deletion test/cases/image.styl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

@import 'nib/image'

#logo
Expand Down
3 changes: 2 additions & 1 deletion test/cases/importance.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
word-break: normal !important;
-moz-tab-size: 4 !important;
-o-tab-size: 4 !important;
tab-size: 4 !important;
-webkit-hyphens: manual !important;
-moz-hyphens: manual !important;
-ms-hyphens: manual !important;
Expand All @@ -129,7 +130,7 @@
font-stretch: condensed !important;
font: normal 16px/1.25 Arial, sans-serif !important;
opacity: 0.5 !important;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50) !important;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)" !important;
filter: alpha(opacity=50) !important;
resize: both !important;
cursor: pointer !important;
Expand Down
72 changes: 36 additions & 36 deletions test/cases/linear-gradient.css
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
body {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #000));
background: -webkit-linear-gradient(top, #fff 0%, #000 100%);
background: -moz-linear-gradient(top, #fff 0%, #000 100%);
background: -o-linear-gradient(top, #fff 0%, #000 100%);
background: -ms-linear-gradient(top, #fff 0%, #000 100%);
background: linear-gradient(top, #fff 0%, #000 100%);
background: -webkit-linear-gradient(top, #fff 0, #000 100%);
background: -moz-linear-gradient(top, #fff 0, #000 100%);
background: -o-linear-gradient(top, #fff 0, #000 100%);
background: -ms-linear-gradient(top, #fff 0, #000 100%);
background: linear-gradient(top, #fff 0, #000 100%);
}
body {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #000));
background: -webkit-linear-gradient(top, #fff 0%, #000 100%);
background: -moz-linear-gradient(top, #fff 0%, #000 100%);
background: -o-linear-gradient(top, #fff 0%, #000 100%);
background: -ms-linear-gradient(top, #fff 0%, #000 100%);
background: linear-gradient(top, #fff 0%, #000 100%);
background: -webkit-linear-gradient(top, #fff 0, #000 100%);
background: -moz-linear-gradient(top, #fff 0, #000 100%);
background: -o-linear-gradient(top, #fff 0, #000 100%);
background: -ms-linear-gradient(top, #fff 0, #000 100%);
background: linear-gradient(top, #fff 0, #000 100%);
}
body {
background: -webkit-gradient(linear, left top, right bottom, color-stop(0, #fff), color-stop(0.25, #f00), color-stop(0.5, #00f), color-stop(1, #000));
background: -webkit-linear-gradient(top left, #fff 0%, #f00 25%, #00f 50%, #000 100%);
background: -moz-linear-gradient(top left, #fff 0%, #f00 25%, #00f 50%, #000 100%);
background: -o-linear-gradient(top left, #fff 0%, #f00 25%, #00f 50%, #000 100%);
background: -ms-linear-gradient(top left, #fff 0%, #f00 25%, #00f 50%, #000 100%);
background: linear-gradient(top left, #fff 0%, #f00 25%, #00f 50%, #000 100%);
background: -webkit-linear-gradient(top left, #fff 0, #f00 25%, #00f 50%, #000 100%);
background: -moz-linear-gradient(top left, #fff 0, #f00 25%, #00f 50%, #000 100%);
background: -o-linear-gradient(top left, #fff 0, #f00 25%, #00f 50%, #000 100%);
background: -ms-linear-gradient(top left, #fff 0, #f00 25%, #00f 50%, #000 100%);
background: linear-gradient(top left, #fff 0, #f00 25%, #00f 50%, #000 100%);
}
body {
background: -webkit-gradient(linear, right bottom, left top, color-stop(0, #fff), color-stop(0.8, #000));
background: -webkit-linear-gradient(bottom right, #fff 0%, #000 80%);
background: -moz-linear-gradient(bottom right, #fff 0%, #000 80%);
background: -o-linear-gradient(bottom right, #fff 0%, #000 80%);
background: -ms-linear-gradient(bottom right, #fff 0%, #000 80%);
background: linear-gradient(bottom right, #fff 0%, #000 80%);
background: -webkit-linear-gradient(bottom right, #fff 0, #000 80%);
background: -moz-linear-gradient(bottom right, #fff 0, #000 80%);
background: -o-linear-gradient(bottom right, #fff 0, #000 80%);
background: -ms-linear-gradient(bottom right, #fff 0, #000 80%);
background: linear-gradient(bottom right, #fff 0, #000 80%);
}
body {
background: -webkit-gradient(linear, right bottom, left top, color-stop(0, #fff), color-stop(0.8, #000));
background: -webkit-linear-gradient(right bottom, #fff 0%, #000 80%);
background: -moz-linear-gradient(right bottom, #fff 0%, #000 80%);
background: -o-linear-gradient(right bottom, #fff 0%, #000 80%);
background: -ms-linear-gradient(right bottom, #fff 0%, #000 80%);
background: linear-gradient(right bottom, #fff 0%, #000 80%);
background: -webkit-linear-gradient(right bottom, #fff 0, #000 80%);
background: -moz-linear-gradient(right bottom, #fff 0, #000 80%);
background: -o-linear-gradient(right bottom, #fff 0, #000 80%);
background: -ms-linear-gradient(right bottom, #fff 0, #000 80%);
background: linear-gradient(right bottom, #fff 0, #000 80%);
}
body {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #000));
background: -webkit-linear-gradient(top, #fff 0%, #000 100%);
background: -moz-linear-gradient(top, #fff 0%, #000 100%);
background: -ms-linear-gradient(top, #fff 0%, #000 100%);
background: -o-linear-gradient(top, #fff 0%, #000 100%);
background: linear-gradient(top, #fff 0%, #000 100%);
background: -webkit-linear-gradient(top, #fff 0, #000 100%);
background: -moz-linear-gradient(top, #fff 0, #000 100%);
background: -ms-linear-gradient(top, #fff 0, #000 100%);
background: -o-linear-gradient(top, #fff 0, #000 100%);
background: linear-gradient(top, #fff 0, #000 100%);
}
body {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #000)), #fff;
background: -webkit-linear-gradient(top, #fff 0%, #000 100%), #fff;
background: -moz-linear-gradient(top, #fff 0%, #000 100%), #fff;
background: -ms-linear-gradient(top, #fff 0%, #000 100%), #fff;
background: -o-linear-gradient(top, #fff 0%, #000 100%), #fff;
background: linear-gradient(top, #fff 0%, #000 100%), #fff;
}
background: -webkit-linear-gradient(top, #fff 0, #000 100%), #fff;
background: -moz-linear-gradient(top, #fff 0, #000 100%), #fff;
background: -ms-linear-gradient(top, #fff 0, #000 100%), #fff;
background: -o-linear-gradient(top, #fff 0, #000 100%), #fff;
background: linear-gradient(top, #fff 0, #000 100%), #fff;
}
2 changes: 1 addition & 1 deletion test/cases/vendor.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ button {
}
button {
opacity: 0.5;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
}
button {
Expand Down
2 changes: 2 additions & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--require should
test/runner.js
3 changes: 0 additions & 3 deletions test/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

require.paths.unshift(__dirname + '/../support');

/**
* Module dependencies.
*/
Expand Down

0 comments on commit 383bcf9

Please sign in to comment.