jacket 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
4
4
  Compass::Frameworks.register('jacket', :path => extension_path)
5
5
 
6
6
  module Jacket
7
- VERSION = "0.1.1"
7
+ VERSION = "0.1.2"
8
8
  DATE = "2013-05-20"
9
9
  end
10
10
 
data/readme.md CHANGED
@@ -1,26 +1,28 @@
1
- ## Jacket
2
- ### Dress appropriately
1
+ # Jacket
2
+
3
+ **Dress your css appropriately.**
3
4
 
4
5
  Jacket is a Sass/Compass component that helps you orgainze stylesheets for a
5
6
  multi-context build process. Write and maintain a master stylesheet, then
6
- output custom tailored stylesheets for specific browsers, mobile/desktop sites,
7
- and app builds.
8
-
9
- ### Installation
7
+ output custom tailored stylesheets for specific browsers, mobile/desktop sites, and app builds.
10
8
 
11
- You can install Jacket from Rubygems:
9
+ ## Installation
12
10
 
13
- `gem install jacket`
11
+ **With Ruby**
14
12
 
15
- with Bower:
13
+ 1. In Terminal: `gem install jacket`
14
+ 2. Require the gem in your config.rb
15
+ 3. Import 'jacket' in your stylesheet.
16
16
 
17
- `bower install jacket`
17
+ **With Bower**
18
18
 
19
- or by downloading manually and requiring with Compass.
19
+ 1. In Terminal: `bower install jacket`
20
+ 2. Add `extensions_dir: "[your Bower component directory]"` to config.rb
21
+ 3. Import 'jacket' in your stylesheet.
20
22
 
21
- ### Usage
23
+ ## Basic Usage
22
24
 
23
- Write all code in a canonical stylesheet.
25
+ Write your code in a master stylesheet.
24
26
 
25
27
  **style.scss**
26
28
 
@@ -28,7 +30,6 @@ Write all code in a canonical stylesheet.
28
30
  .rainy {
29
31
  // Universal rules
30
32
  font-size: 1rem;
31
- width: 90%;
32
33
 
33
34
  // Styles for iOS only
34
35
  @include jacket(ios) {
@@ -36,7 +37,7 @@ Write all code in a canonical stylesheet.
36
37
  content: 'Double ristretto cortado, stat.';
37
38
  }
38
39
  // Styles for Android 2.x only
39
- @include jacket(andr-2x) {
40
+ @include jacket(android-2x) {
40
41
  background-color: #baddad;
41
42
  content: 'I should get a new phone.';
42
43
  }
@@ -48,7 +49,7 @@ Write all code in a canonical stylesheet.
48
49
  }
49
50
  ```
50
51
 
51
- Then create stylesheets for each build, and tell Jacket what the weather is.
52
+ Then create a stylesheet for each build context, and tell Jacket what the weather is.
52
53
 
53
54
  **style.ios.scss**
54
55
 
@@ -57,10 +58,9 @@ Then create stylesheets for each build, and tell Jacket what the weather is.
57
58
  $jacket: ios;
58
59
  @import 'style';
59
60
 
60
- // Compiled result
61
+ // Compiles to
61
62
  .rainy {
62
63
  font-size: 1rem;
63
- width: 90%;
64
64
  background-color: #c0ffee;
65
65
  content: 'Double ristretto cortado, stat.';
66
66
  }
@@ -70,13 +70,12 @@ $jacket: ios;
70
70
 
71
71
  ```scss
72
72
  // Set the weather
73
- $jacket: andr-2x;
73
+ $jacket: android-2x;
74
74
  @import 'style';
75
75
 
76
- // Compiled result
76
+ // Compiles to
77
77
  .rainy {
78
78
  font-size: 1rem;
79
- width: 90%;
80
79
  background-color: #baddad;
81
80
  content: 'I should get a new phone.';
82
81
  }
@@ -89,65 +88,111 @@ $jacket: andr-2x;
89
88
  $jacket: ie8;
90
89
  @import 'style';
91
90
 
92
- // Compiled result
91
+ //Compiles to:
93
92
  .rainy {
94
93
  font-size: 1rem;
95
- width: 90%;
96
94
  background-color: #000;
97
95
  content: 'Round three. FIGHT!';
98
96
  }
99
97
  ```
100
98
 
101
- You can set multiple comma separated contexts in `$jacket`.
99
+ Now use an automated build process, conditional comments, or some fancy scripting to give each of your chosen environments a stylesheet made just for them. Not too much, not too little. Those stylesheets are lookin' good.
102
100
 
103
- **style.scss**
101
+ ## Advanced Usage
102
+
103
+ You want to take it to the next level? Yeah, we have another level you can take it to.
104
+
105
+ #### Wrapping selector
106
+
107
+ Add a wrapping selector to a jacket context. Make sure to surround the selector with quotes.
104
108
 
105
109
  ```scss
106
- // Set the weather
107
- $jacket: ios, andr-2x;
110
+ .drizzle {
111
+ // universal styles
112
+ @include jacket(mackintosh) {
113
+ // macintosh styles
114
+ }
115
+ }
116
+ ```
117
+
118
+ **style.mackintosh.scss**
119
+
120
+ ```scss
121
+ $jacket: mackintosh '.mack';
108
122
  @import 'style';
109
123
 
110
- // Compiled result (bad example, but you get the idea)
111
- .rainy {
112
- font-size: 1rem;
113
- width: 90%;
114
- background-color: #c0ffee;
115
- content: 'Double ristretto cortado, stat.';
116
- background-color: #baddad;
117
- content: 'I should get a new phone.';
124
+ // Compiles to
125
+ .drizzle {
126
+ // universal styles
127
+ }
128
+ .mack .drizzle {
129
+ // mackintosh styles
118
130
  }
119
131
  ```
120
132
 
121
- Or output a context wrapped in selectors, if that's your thing.
133
+ #### Multiple contexts in one stylesheet
122
134
 
123
- **style.scss**
135
+ Set multiple comma separated contexts in `$jacket`. If any context matches a value that jacket will be output.
124
136
 
125
137
  ```scss
126
- // Set the weather. Make sure to surround your selector with quotes.
127
- $jacket: ie8 '.ltie9';
138
+ .thunderstorm {
139
+ // universal styles
140
+ @include jacket(anorak) {
141
+ // anorak styles
142
+ }
143
+ @include jacket(windbreaker) {
144
+ // windbreaker styles
145
+ }
146
+ }
147
+ ```
148
+
149
+ **style.wetandcold.scss**
150
+
151
+ ```scss
152
+ $jacket: anorak, windbreaker;
128
153
  @import 'style';
129
154
 
130
- // Compiled result
131
- .rainy {
132
- font-size: 1rem;
133
- width: 90%;
155
+ // Compiles to
156
+ .thunderstorm {
157
+ // universal styles
158
+ // anorak styles
159
+ // windbreaker styles
134
160
  }
161
+ ```
135
162
 
136
- .ltie9 .rainy {
137
- background-color: #000;
138
- content: 'Round three. FIGHT!';
163
+ #### Jackets that match multiple contexts
164
+
165
+ Set multiple values for a single jacket mixin. If a context matches any value, the jacket will be output.
166
+
167
+ ```scss
168
+ .soiree {
169
+ // universal styles
170
+ @include jacket(suit, coat, tie) {
171
+ // styles that should be used with any suit, coat, or tie
172
+ }
139
173
  }
140
174
  ```
175
+ **style.tie.scss**
141
176
 
142
- Complex Jacket contexts like `$jacket: mdot, ie7 '.ltie9', ie8 'ltie9'` work just fine.
177
+ ```scss
178
+ $jacket: tie;
179
+ @import 'style';
180
+
181
+ // Compiled result
182
+ .soiree {
183
+ // universal styles
184
+ // styles that should be used with any suit, coat, or tie
185
+ }
186
+ ```
143
187
 
144
- ### Strut your stuff
188
+ #### And more...
145
189
 
146
- Now use a build process, conditional comments, or some fancy scripting to give each of your chosen environments a stylesheet made just for them. Not too much, not too little. Those stylesheets are lookin' good.
190
+ Check out the [tests](https://github.com/Team-Sass/jacket/tree/master/test) for more examples, including condtional logic with nested jackets and a simple media query fallback mixin.
147
191
 
148
- ### Todo
192
+ ## Todo
149
193
 
150
- 1. Better documentation, including `jacket-context()` function.
151
- 2. Remove `lib` and Compass dependencies when `list-separator()` lands in Sass.
194
+ 1. Document `jacket-context()` function.
195
+ 2. Set up automated testing framework.
196
+ 4. Remove `lib` and Compass dependencies when `list-separator()` lands in Sass.
152
197
 
153
- <small>*Thanks to [Breakpoint](https://github.com/Team-Sass/breakpoint), who's no-query functionality inspired this project.*</small>
198
+ <small>*Thanks to [Breakpoint](https://github.com/Team-Sass/breakpoint), who's no-query functionality inspired this project.*</small>
@@ -12,7 +12,7 @@
12
12
  // Settings variables
13
13
  ///////////////////////////////////////////////////////////
14
14
 
15
- // A list of jackets to print in the stylesheet.
15
+ // A list of jacket contexts to print in the stylesheet.
16
16
  $jacket: null !default;
17
17
 
18
18
  // A private variable used by jacket-context().
@@ -29,16 +29,15 @@ $jckt-context: null;
29
29
  $filtered: ();
30
30
  $selector-string: '';
31
31
 
32
- // Set the global $jacket-context variable.
32
+ // Set the global context variable.
33
33
  $jckt-context: $args;
34
34
 
35
- // If jacket is a single jacket value and selector list, encapsulate so it's
36
- // sent through the next function in one piece.
35
+ // If jacket is a single context and selector list, encapsulate.
37
36
  @if list-separator($jacket) == 'space' {
38
37
  $jacket: $jacket, null;
39
38
  }
40
39
 
41
- // Test if the stylesheet's $jacket variable and jacket mixin arguments match.
40
+ // Test if a jacket context and jacket value match.
42
41
  @each $item in $jacket {
43
42
  @if index($args, nth($item, 1)) {
44
43
 
@@ -52,15 +51,15 @@ $jckt-context: null;
52
51
  }
53
52
  }
54
53
 
55
- // Filter out duplicate selectors. We can simplify if reject() is added to
56
- // Sass.
54
+ // Filter out duplicate selectors.
55
+ // If reject() is added to Sass we can remove the $filtered holder variable.
57
56
  @each $selector in $selectors {
58
57
  @if index($filtered, $selector) == false {
59
58
  $filtered: append($filtered, $selector);
60
59
  }
61
60
  }
62
61
 
63
- // Build the selector string and output.
62
+ // Build the selector string.
64
63
  @each $selector in $filtered {
65
64
  @if $selector-string != '' {
66
65
  $selector-string: $selector-string + ", ";
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jacket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: