bourbon 0.0.8 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  *swp
2
2
  *gem
3
3
  .sass-cache/
4
- sass/
4
+ bourbon/
5
+ demo/
@@ -1,10 +1,11 @@
1
1
  // Custom Functions
2
- @import "functions/compact";
3
2
  @import "functions/golden-ratio";
4
3
  @import "functions/tint-shade";
4
+ @import "functions/linear-gradient";
5
5
 
6
6
  // CSS3 Mixins
7
7
  @import "css3/animation";
8
+ @import "css3/background-image";
8
9
  @import "css3/border-radius";
9
10
  @import "css3/box-shadow";
10
11
  @import "css3/box-sizing";
@@ -0,0 +1,119 @@
1
+ // Background image property for support with adding multiple background images with a gradients.
2
+
3
+ @mixin background-image(
4
+ $image-1 , $image-2: false,
5
+ $image-3: false, $image-4: false,
6
+ $image-5: false, $image-6: false,
7
+ $image-7: false, $image-8: false,
8
+ $image-9: false, $image-10: false
9
+ ) {
10
+ $images: compact($image-1, $image-2,
11
+ $image-3, $image-4,
12
+ $image-5, $image-6,
13
+ $image-7, $image-8,
14
+ $image-9, $image-10);
15
+
16
+ $assets: false;
17
+ $gradients: false;
18
+ $count: 0;
19
+
20
+ //Find all asset images in list
21
+ @for $i from 1 through length($images) {
22
+ $type: type-of(nth($images, $i));
23
+
24
+ @if $type == list {
25
+ $count: $count + 1;
26
+ }
27
+
28
+ @else if $type == string {
29
+ @if $assets == false {
30
+ $assets: nth($images, $i);
31
+ }
32
+
33
+ @else {
34
+ $assets: join($assets, nth($images, $i), comma);
35
+ }
36
+ }
37
+ }
38
+
39
+ // Find all gradients in list
40
+ @for $i from 1 through length($images) {
41
+ $type: type-of(nth($images, $i));
42
+
43
+ @if $type == list {
44
+ @if $gradients == false {
45
+ $gradients: nth($images, $i);
46
+ }
47
+ @else {
48
+ $gradients: $gradients, nth($images, $i);
49
+ }
50
+ }
51
+ }
52
+
53
+ @function render-gradients($gradients, $vendor: false) {
54
+ @if $count == 1 {
55
+ $vendor-gradients: false;
56
+ @if $vendor {
57
+ $vendor-gradients: -#{$vendor}-linear-gradient($gradients);
58
+ }
59
+ @else if $vendor == false {
60
+ $vendor-gradients: linear-gradient($gradients);
61
+ }
62
+ @return $vendor-gradients;
63
+ }
64
+
65
+ @else if $count >= 2 {
66
+ $vendor-gradients: false;
67
+ @for $i from 1 through length($gradients) {
68
+ @if $vendor {
69
+ @if $vendor-gradients == false {
70
+ $vendor-gradients: -#{$vendor}-linear-gradient(nth($gradients, $i));
71
+ }
72
+ @else {
73
+ $vendor-gradients: $vendor-gradients, -#{$vendor}-linear-gradient(nth($gradients, $i));
74
+ }
75
+ }
76
+ @else if $vendor == false {
77
+ @if $vendor-gradients {
78
+ $vendor-gradients: "linear-gradient(#{nth($gradients, $i)})";
79
+ $vendor-gradients: unquote($vendor-gradients);
80
+ }
81
+ @else {
82
+ $vendor-gradients: $vendor-gradients, "linear-gradient( #{nth($gradients, $i)} )";
83
+ $vendor-gradients: unquote($vendor-gradients);
84
+ }
85
+ }
86
+ }
87
+ @return $vendor-gradients;
88
+ }
89
+ }
90
+
91
+
92
+ @if $assets {
93
+ @if $count >= 1 {
94
+ background-image: $assets, render-gradients($gradients, webkit);
95
+ background-image: $assets, render-gradients($gradients, moz);
96
+ background-image: $assets, render-gradients($gradients, ms);
97
+ background-image: $assets, render-gradients($gradients, o);
98
+ background-image: $assets, render-gradients($gradients);
99
+
100
+ }
101
+ @else {
102
+ background-image: $assets;
103
+ }
104
+ }
105
+ @else {
106
+ @if $count >= 1 {
107
+ background-image: render-gradients($gradients, webkit);
108
+ background-image: render-gradients($gradients, moz);
109
+ background-image: render-gradients($gradients, ms);
110
+ background-image: render-gradients($gradients, o);
111
+ background-image: render-gradients($gradients);
112
+ }
113
+ }
114
+
115
+ }
116
+
117
+ //Examples:
118
+ //@include background-image(url("/images/a.png"), linear-gradient(#ffff00, #999));
119
+ //@include background-image(url("/images/a.png"), url("/images/b.png"), url("/images/c.png"), linear-gradient(#ffff00 10%, #000 20%));
@@ -1,5 +1,13 @@
1
1
  // CSS3 Flexible Box Model and property defaults
2
2
 
3
+ // Custom shorthand notation for flexbox
4
+ @mixin box($orient: inline-axis, $pack: start, $align: stretch) {
5
+ @include display-box;
6
+ @include box-orient($orient);
7
+ @include box-pack($pack);
8
+ @include box-align($align);
9
+ }
10
+
3
11
  @mixin display-box {
4
12
  display: -webkit-box;
5
13
  display: -moz-box;
@@ -8,7 +8,7 @@
8
8
  $pos-type: type-of(nth($pos, 1));
9
9
 
10
10
  // If $pos is missing from mixin, reassign vars and add default position
11
- @if $pos-type == color {
11
+ @if $pos-type == color or transparent {
12
12
  $G10: $G9; $G9: $G8; $G8: $G7; $G7: $G6; $G6: $G5;
13
13
  $G5: $G4; $G4: $G3; $G3: $G2; $G2: $G1; $G1: $pos;
14
14
  $pos: top; // Default position
@@ -17,15 +17,15 @@
17
17
  }
18
18
 
19
19
  // div {
20
- // Increment Up GR with positive value
21
- // width: golden-ratio(14px, 1); // returns: 22.652px
20
+ // Increment Up GR with positive value
21
+ // font-size: golden-ratio(14px, 1); // returns: 22.652px
22
22
  //
23
- // Increment Down GR with negative value
24
- // width: golden-ratio(14px, -1); // returns: 8.653px
23
+ // Increment Down GR with negative value
24
+ // font-size: golden-ratio(14px, -1); // returns: 8.653px
25
25
  //
26
- // Can be used with ceil(round up) or floor(round down)
27
- // width: floor( golden-ratio(14px, 1) ); // returns: 22px
28
- // width: ceil( golden-ratio(14px, 1) ); // returns: 23px
26
+ // Can be used with ceil(round up) or floor(round down)
27
+ // font-size: floor( golden-ratio(14px, 1) ); // returns: 22px
28
+ // font-size: ceil( golden-ratio(14px, 1) ); // returns: 23px
29
29
  // }
30
30
  //
31
31
  // modularscale.com
@@ -0,0 +1,28 @@
1
+ @function linear-gradient($pos: top, $G1: false, $G2: false,
2
+ $G3: false, $G4: false,
3
+ $G5: false, $G6: false,
4
+ $G7: false, $G8: false,
5
+ $G9: false, $G10: false) {
6
+
7
+ // Detect what type of value exists in $pos
8
+ $pos-type: type-of(nth($pos, 1));
9
+
10
+ // If $pos is missing from mixin, reassign vars and add default position
11
+ @if $pos-type == color or transparent {
12
+ $G10: $G9; $G9: $G8; $G8: $G7; $G7: $G6; $G6: $G5;
13
+ $G5: $G4; $G4: $G3; $G3: $G2; $G2: $G1; $G1: $pos;
14
+ $pos: top; // Default position
15
+ }
16
+
17
+ $full: compact($G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10);
18
+
19
+ //If position was included in the mixin/function
20
+ @if type-of(nth($full, 1)) != color or transparent {
21
+ @return $full;
22
+ }
23
+
24
+ //Else add the default position
25
+ @else {
26
+ @return join($pos, $full, comma);
27
+ }
28
+ }
@@ -0,0 +1,28 @@
1
+ #!/bin/sh
2
+
3
+ # README
4
+ # This will generate a bourbon directory and convert all .css.scss to .scss extensions.
5
+ # The bourbon directory is for 'sass --watch' use outside of rails.
6
+ # Step 1: Make install executable by changing permission
7
+ # chmod a+x generate-sass.sh
8
+
9
+ # Step 2: Generate Files
10
+ # ./generate-sass.sh
11
+
12
+ echo Creating directory...
13
+ mkdir -p $PWD/bourbon/lib
14
+
15
+ echo Copying files...
16
+ cp -a $PWD/app/assets/stylesheets/* $PWD/bourbon
17
+ cp -a $PWD/lib/* $PWD/bourbon/lib
18
+ rm -r $PWD/bourbon/lib/tasks
19
+ rm -r $PWD/bourbon/lib/bourbon/engine.rb
20
+ rm -r $PWD/bourbon/lib/bourbon/version.rb
21
+
22
+ echo Renaming files...
23
+ find $PWD/bourbon -name "*.css.scss" | while read i;
24
+ do mv "$i" "${i%.css.scss}.scss";
25
+ done
26
+
27
+ echo Done.
28
+
@@ -1,13 +1,17 @@
1
1
  module Bourbon
2
- class Engine < ::Rails::Engine
3
- require 'bourbon/engine'
4
- end
2
+ if defined?(Rails)
3
+ class Engine < ::Rails::Engine
4
+ require 'bourbon/engine'
5
+ end
5
6
 
6
- module Rails
7
- class Railtie < ::Rails::Railtie
8
- rake_tasks do
9
- load "tasks/install.rake"
7
+ module Rails
8
+ class Railtie < ::Rails::Railtie
9
+ rake_tasks do
10
+ load "tasks/install.rake"
11
+ end
10
12
  end
11
13
  end
12
14
  end
13
15
  end
16
+
17
+ require "bourbon/sass_extensions"
@@ -1,3 +1,3 @@
1
1
  module Bourbon
2
- VERSION = "0.0.8"
2
+ VERSION = "0.1.1"
3
3
  end
data/readme.md CHANGED
@@ -1,5 +1,5 @@
1
1
  #Bourbon Sass Mixins
2
- The purpose of Bourbon Sass Mixins is to provide a comprehensive framework of sass mixins that are designed to be as vanilla as possible. Meaning they should not deter from the original CSS syntax. The mixins contain vendor specific prefixes for all CSS3 properties for support amongst modern browsers. The prefixes also ensure graceful degradation for older browsers that support only CSS3 prefixed properties.
2
+ The purpose of Bourbon Sass Mixins is to provide a comprehensive library of sass mixins that are designed to be as vanilla as possible. Meaning they should not deter from the original CSS syntax. The mixins contain vendor specific prefixes for all CSS3 properties for support amongst modern browsers. The prefixes also ensure graceful degradation for older browsers that support only CSS3 prefixed properties.
3
3
  Bourbon uses SCSS syntax.
4
4
 
5
5
  #Requirements
@@ -35,18 +35,24 @@ Import the mixins at the beginning of your stylesheet
35
35
 
36
36
 
37
37
  #Install without Rails
38
- The following script will generate a sass directory and convert all .css.scss to .scss extensions. The sass directory is for 'sass --watch' use outside of rails.
39
- Preliminary step: clone the repo and cd into the directory.
38
+ The following script will generate a *bourbon* directory and convert all .css.scss to .scss extensions. The *bourbon* directory is for 'sass --watch' use outside of rails.
39
+ Preliminary step: clone this repo and cd into the directory.
40
40
 
41
41
  **Step 1:** Make script executable by changing file permission
42
42
 
43
- chmod a+x generate-sass.sh
43
+ chmod a+x generate-bourbon.sh
44
44
 
45
45
  **Step 2:** Generate files
46
46
 
47
- ./generate-sass.sh
47
+ ./generate-bourbon.sh
48
48
 
49
- **Step 3:** Move the new *sass* directory to your project's stylesheets directory.
49
+ **Step 3:** Move the new *bourbon* directory into your project's sass directory. *e.g. stylesheets/sass/*
50
+
51
+ **Step 4:** Bourbon requires an additional sass extension to output properly. You must watch your sass files with the following flag appended:
52
+ *-r ./bourbon/lib/bourbon.rb*
53
+
54
+ # Example (project root directory)
55
+ sass --watch stylesheets/sass:stylesheets -r ./stylesheets/sass/bourbon/lib/bourbon.rb
50
56
 
51
57
 
52
58
  #Using Bourbon Vanilla Mixins
@@ -64,6 +70,20 @@ The animation mixins support comma separated lists of values, which allows diffe
64
70
  @include animation-basic((slideup, fadein), (1.0s, 2.0s), ease-in);
65
71
 
66
72
 
73
+ ###Background-image
74
+
75
+ The background-image mixin is helpful for chaining multiple comma deliminated background images and/or linear-gradients into one background-image property.Background-image supports up to 10 background-images.
76
+
77
+ # Multiple image assets
78
+ @include background-image(url("/images/a.png"), url("images/b.png"));
79
+
80
+ # Image asset with a linear-gradient
81
+ @include background-image(url("/images/a.png"), linear-gradient(white 0, yellow 50%, transparent 50%));
82
+
83
+ # Multiple linear-gradients;
84
+ @include background-image(linear-gradient(hsla(0, 100%, 100%, 0.25) 0%, hsla(0, 100%, 100%, 0.08) 50%, transparent 50%), linear-gradient(#4e7ba3, darken(#4e7ba4, 10%)) );
85
+
86
+
67
87
  ###Border Radius
68
88
 
69
89
  Border-radius will also take short-hand notation.
@@ -104,6 +124,11 @@ The flex-box mixin is based on the 2009 w3c spec. The mixin with change to the f
104
124
  @include box-flex(2);
105
125
  }
106
126
 
127
+ # Alternative custom shorthand mixin.
128
+ div.parent {
129
+ @include box($orient: horizontal, $pack: center, $align: stretch);
130
+ }
131
+
107
132
 
108
133
  ###Inline-block
109
134
 
@@ -175,20 +200,31 @@ The compact function will strip out any value from a list that is 'false'. Takes
175
200
  Returns the golden ratio of a given number. Must provide a Pixel or Em value for first argument. Also takes a required increment value that is not zero and an integer: ...-3, -2, -1, 1, 2, 3...
176
201
 
177
202
  div {
178
- Increment Up GR with positive value
179
- width: golden-ratio(14px, 1); // returns: 22.652px
203
+ Increment Up GR with positive value
204
+ font-size: golden-ratio(14px, 1); // returns: 22.652px
180
205
 
181
- Increment Down GR with negative value
182
- width: golden-ratio(14px, -1); // returns: 8.653px
206
+ Increment Down GR with negative value
207
+ font-size: golden-ratio(14px, -1); // returns: 8.653px
183
208
 
184
- Can be used with ceil(round up) or floor(round down)
185
- width: floor( golden-ratio(14px, 1) ); // returns: 22px
186
- width: ceil( golden-ratio(14px, 1) ); // returns: 23px
209
+ Can be used with ceil(round up) or floor(round down)
210
+ font-size: floor( golden-ratio(14px, 1) ); // returns: 22px
211
+ font-size: ceil( golden-ratio(14px, 1) ); // returns: 23px
187
212
  }
188
213
 
189
214
  Resources: [modularscale.com](http://modularscale.com) & [goldenratiocalculator.com](http://goldenratiocalculator.com)
190
215
 
191
216
 
217
+ ###Linear-gradient
218
+
219
+ Outputs a linear-gradient. Use in conjuntion with the background-image mixin. The function takes the same arguments as the linear-gradient mixin (See Mixins section of this README).
220
+
221
+ # Image asset with a linear-gradient
222
+ @include background-image(url("/images/a.png"), linear-gradient(white 0, yellow 50%, transparent 50%));
223
+
224
+ # Multiple linear-gradients;
225
+ @include background-image(linear-gradient(hsla(0, 100%, 100%, 0.25) 0%, hsla(0, 100%, 100%, 0.08) 50%, transparent 50%), linear-gradient(#4e7ba3, darken(#4e7ba4, 10%)) );
226
+
227
+
192
228
  ###Grid-width
193
229
 
194
230
  Easily setup and follow a grid based design. Need help gridding? Check out [gridulator.com](http://gridulator.com/)
@@ -253,6 +289,7 @@ The real power of the mixin is revealed when you pass in the optional color argu
253
289
  --------------------------------
254
290
  compact(*args)
255
291
  golden-ratio(*args)
292
+ linear-gradient(*args)
256
293
  grid-width(*args)
257
294
  shade(*args)
258
295
  tint(*args)
@@ -271,10 +308,12 @@ The real power of the mixin is revealed when you pass in the optional color argu
271
308
  @ animation-play-state(*args)
272
309
  @ animation-timing-function(*args)
273
310
 
311
+ @ background-image(*args)
274
312
  @ border-radius(*args)
275
313
  @ box-sizing(*args)
276
314
 
277
315
  flex-box
316
+ @ box(*args)
278
317
  @ box-align(*args)
279
318
  @ box-direction(*args)
280
319
  @ box-flex(*args)
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bourbon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 0
9
- - 8
10
- version: 0.0.8
7
+ - 1
8
+ - 1
9
+ version: 0.1.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Phil LaPier
@@ -17,7 +16,8 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2011-07-11 00:00:00 Z
19
+ date: 2011-07-18 00:00:00 -04:00
20
+ default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: sass
@@ -27,7 +27,6 @@ dependencies:
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- hash: 5
31
30
  segments:
32
31
  - 3
33
32
  - 1
@@ -59,6 +58,7 @@ files:
59
58
  - app/assets/stylesheets/addons/_button.css.scss
60
59
  - app/assets/stylesheets/addons/_position.css.scss
61
60
  - app/assets/stylesheets/css3/_animation.css.scss
61
+ - app/assets/stylesheets/css3/_background-image.css.scss
62
62
  - app/assets/stylesheets/css3/_border-radius.css.scss
63
63
  - app/assets/stylesheets/css3/_box-shadow.css.scss
64
64
  - app/assets/stylesheets/css3/_box-sizing.css.scss
@@ -68,17 +68,21 @@ files:
68
68
  - app/assets/stylesheets/css3/_radial-gradient.css.scss
69
69
  - app/assets/stylesheets/css3/_transform.css.scss
70
70
  - app/assets/stylesheets/css3/_transition.css.scss
71
- - app/assets/stylesheets/functions/_compact.css.scss
72
71
  - app/assets/stylesheets/functions/_golden-ratio.css.scss
73
72
  - app/assets/stylesheets/functions/_grid-width.css.scss
73
+ - app/assets/stylesheets/functions/_linear-gradient.css.scss
74
74
  - app/assets/stylesheets/functions/_tint-shade.css.scss
75
75
  - bourbon.gemspec
76
- - generate-sass.sh
76
+ - generate-bourbon.sh
77
77
  - lib/bourbon.rb
78
78
  - lib/bourbon/engine.rb
79
+ - lib/bourbon/sass_extensions.rb
80
+ - lib/bourbon/sass_extensions/functions.rb
81
+ - lib/bourbon/sass_extensions/functions/compact.rb
79
82
  - lib/bourbon/version.rb
80
83
  - lib/tasks/install.rake
81
84
  - readme.md
85
+ has_rdoc: true
82
86
  homepage: https://github.com/thoughtbot/bourbon
83
87
  licenses: []
84
88
 
@@ -92,7 +96,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
96
  requirements:
93
97
  - - ">="
94
98
  - !ruby/object:Gem::Version
95
- hash: 3
96
99
  segments:
97
100
  - 0
98
101
  version: "0"
@@ -101,14 +104,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
104
  requirements:
102
105
  - - ">="
103
106
  - !ruby/object:Gem::Version
104
- hash: 3
105
107
  segments:
106
108
  - 0
107
109
  version: "0"
108
110
  requirements: []
109
111
 
110
112
  rubyforge_project: bourbon
111
- rubygems_version: 1.8.5
113
+ rubygems_version: 1.3.7
112
114
  signing_key:
113
115
  specification_version: 3
114
116
  summary: Bourbon Sass Mixins using SCSS syntax.
@@ -1,16 +0,0 @@
1
- @function compact($var-1, $var-2: false,
2
- $var-3: false, $var-4: false,
3
- $var-5: false, $var-6: false,
4
- $var-7: false, $var-8: false,
5
- $var-9: false, $var-10: false) {
6
- $full: $var-1;
7
- $vars: $var-2, $var-3, $var-4, $var-5,
8
- $var-6, $var-7, $var-8, $var-9, $var-10;
9
-
10
- @each $var in $vars {
11
- @if $var {
12
- $full: $full, $var;
13
- }
14
- }
15
- @return $full;
16
- }
@@ -1,23 +0,0 @@
1
- #!/bin/sh
2
-
3
- # README
4
- # This will generate a sass directory and convert all .css.scss to .scss extensions.
5
- # The sass directory is for 'sass --watch' use outside of rails.
6
- # Step 1: Make install executable by changing permission
7
- # chmod a+x generate-sass.sh
8
-
9
- # Step 2: Generate Files
10
- # ./generate-sass.sh
11
-
12
- echo Creating directory...
13
- mkdir -p $PWD/sass
14
-
15
- echo Copying files...
16
- cp -a $PWD/app/assets/stylesheets/* $PWD/sass
17
-
18
- echo Renaming files...
19
- find $PWD/sass -name "*.css.scss" | while read i;
20
- do mv "$i" "${i%.css.scss}.scss";
21
- done
22
- echo Done.
23
-