Skip to content

Commit 2b3a97c

Browse files
author
Jeff Escalante
committed
Merge pull request #41 from imrefazekas/master
added hd option
2 parents 12de230 + e4d1b83 commit 2b3a97c

File tree

6 files changed

+42
-9
lines changed

6 files changed

+42
-9
lines changed

readme.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,29 @@ Pixel value where the `mobile` mixin kicks in, also the lower bound of the `tabl
3636
##### `rupture.desktop-cutoff`
3737
Pixel value where the `desktop` mixin kicks in, also the upper bound of the `tablet` mixin.
3838

39+
##### `rupture.hd-cutoff`
40+
Pixel value where the `hd` mixin kicks in, meaning a wider desktop-screen.
41+
3942
##### `rupture.scale`
4043
A list of values that you can reference by index in most of the mixins listed below. This works exactly like [breakpoint-slicer](https://github.com/lolmaus/breakpoint-slicer). Default looks like this:
4144

4245
```js
43-
rupture.scale = 0 400px 600px 800px 1050px
46+
rupture.scale = 0 400px 600px 800px 1050px 1800px
4447
```
4548

4649
##### `rupture.scale-names`
4750
A list of strings you can reference that correspond to their index location in `rupture.scale`. This works exactly like [breakpoint-slicer](https://github.com/lolmaus/breakpoint-slicer#calling-slices-by-names-rather-than-numbers)
4851

4952
```
50-
rupture.scale = 0 400px 600px 800px 1050px
53+
rupture.scale = 0 400px 600px 800px 1050px 1800px
5154
52-
// └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────
53-
// Slice numbers: 1 2 3 4 5
54-
rupture.scale-names: 'xs' 's' 'm' 'l' 'xl'
55+
// └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────
56+
// Slice numbers: 1 2 3 4 5 6
57+
rupture.scale-names: 'xs' 's' 'm' 'l' 'xl' 'hd'
5558
```
5659

5760
```js
58-
rupture.scale-names = 'xs' 's' 'm' 'l' 'xl'
61+
rupture.scale-names = 'xs' 's' 'm' 'l' 'xl' 'hd'
5962
```
6063

6164
##### `rupture.enable-em-breakpoints`
@@ -138,6 +141,9 @@ When the screen size is between 1050px (defined by `rupture.desktop-cutoff`) and
138141
##### `+desktop()`
139142
When the screen size is 1050px (defined by `rupture.desktop-cutoff`) or more, the styles in the block will take effect.
140143

144+
##### `+hd()`
145+
When the screen size is 1800px (defined by `rupture.hd-cutoff`) or more, the styles in the block will take effect.
146+
141147
##### `+density(value)`
142148
When the device has a pixel density of at least the given `value`, the styles in the block will take effect. The `value` should be a unitless pixel ratio number such as `1`, `1.5`, or `2`. The `value` can also be `retina`, in which case the `rupture.retina-density` variable will be used.
143149

@@ -234,6 +240,8 @@ If you don't want to enable anti-overlapping globally, you can enable or disable
234240
font-weight normal
235241
+desktop(anti-overlap: true)
236242
font-style italic
243+
+hd(anti-overlap: true)
244+
font-style oblique
237245
```
238246

239247
The `anti-overlap` offset list may contain positive or negative values. Positive values will increase the media query's `min-width` argument, while negative values will decrease the `max-width` argument.

rupture/index.styl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ base-font-size ?= 16px
33
rupture = {
44
mobile-cutoff: 400px
55
desktop-cutoff: 1050px
6+
hd-cutoff: 1800px
67
enable-em-breakpoints: false
78
base-font-size: base-font-size
89
anti-overlap: false
910
density-queries: 'dppx' 'webkit' 'moz' 'dpi'
1011
retina-density: 1.5
1112
use-device-width: false
1213
}
13-
rupture.scale = 0 (rupture.mobile-cutoff) 600px 800px (rupture.desktop-cutoff)
14-
rupture.scale-names = 'xs' 's' 'm' 'l' 'xl'
14+
rupture.scale = 0 (rupture.mobile-cutoff) 600px 800px (rupture.desktop-cutoff) (rupture.hd-cutoff)
15+
rupture.scale-names = 'xs' 's' 'm' 'l' 'xl' 'hd'
1516
-is-string(val)
1617
if typeof(val) is not 'unit'
1718
if val is a 'string' or val is a 'ident'
@@ -181,6 +182,14 @@ desktop(anti-overlap = rupture.anti-overlap, density = null, orientation = null,
181182
+above(rupture.desktop-cutoff, anti-overlap, density, orientation, use-device-width)
182183
{block}
183184

185+
hd(anti-overlap = rupture.anti-overlap, density = null, orientation = null, use-device-width = rupture.use-device-width)
186+
if -is-string(orientation)
187+
orientation = convert(orientation)
188+
if -is-string(density)
189+
density = convert(density)
190+
+above(rupture.hd-cutoff, anti-overlap, density, orientation, use-device-width)
191+
{block}
192+
184193
density(density, orientation = null)
185194
conditions = ()
186195
for query in -density-queries(density)

test/fixtures/expected/hd.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.hello {
2+
color: #f00;
3+
}
4+
@media only screen and (min-width: 1800px) {
5+
.hello {
6+
color: #00f;
7+
}
8+
}

test/fixtures/expected/named.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
color: #0f0;
2222
}
2323
}
24-
@media only screen and (min-width: 1050px) {
24+
@media only screen and (min-width: 1050px) and (max-width: 1800px) {
2525
.hello {
2626
color: #ccc;
2727
}

test/fixtures/hd.styl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.hello
2+
color: red
3+
4+
+hd()
5+
color: blue

test/test.coffee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ describe 'basic', ->
4444
it 'desktop', (done) ->
4545
match_expected('desktop.styl', done)
4646

47+
it 'hd', (done) ->
48+
match_expected('hd.styl', done)
49+
4750
it 'retina', (done) ->
4851
match_expected('retina.styl', done)
4952

0 commit comments

Comments
 (0)