mq-sass 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.editorconfig +12 -0
- data/.gitignore +3 -0
- data/.npmignore +8 -0
- data/CHANGELOG.md +31 -0
- data/Gemfile +3 -0
- data/LICENSE.md +23 -0
- data/README.md +386 -0
- data/bower.json +39 -0
- data/eyeglass-exports.js +7 -0
- data/index.js +7 -0
- data/lib/mq-sass.rb +19 -0
- data/lib/mq-sass/version.rb +3 -0
- data/mq-sass.gemspec +17 -0
- data/package.json +33 -0
- data/stylesheets/_mq-sass.scss +82 -0
- data/stylesheets/mq-sass/_functions.scss +23 -0
- data/stylesheets/mq-sass/_settings.scss +24 -0
- metadata +61 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: fec9758106e5f6e6c8d5d26a19354a50a7ce7c88
|
|
4
|
+
data.tar.gz: 71dc489fa6e225de84d8606b34ccda5b6af7be99
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5275a3b1f5de80a844b2160dbb9e2445403434cc35f75057012f9691f9cfde9ffb24a87aa0008bd5ba52219b0af6f90e91fd1b446b9ea36f556b77347e11a519
|
|
7
|
+
data.tar.gz: 10e93e44d9d79c600d7fc05ffe3bfeb405fb56560129d562be582908efc8c1746f3b64b9b275d2df53bca02a3a64b110c79f9f950b673c52744781d5ff73854a
|
data/.editorconfig
ADDED
data/.gitignore
ADDED
data/.npmignore
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Changelog for mq-sass.
|
|
4
|
+
|
|
5
|
+
## [0.7.0] - 12/02/2016
|
|
6
|
+
### Added
|
|
7
|
+
- [Ruby gem](https://rubygems.org/gems/mq-sass) support.
|
|
8
|
+
- [Eyeglass](http://eyeglass.rocks/) support.
|
|
9
|
+
|
|
10
|
+
## [0.6.0] - 05/19/2016
|
|
11
|
+
### Fixed
|
|
12
|
+
- Fix bug where units are excluded when `$mq-ems: false`.
|
|
13
|
+
|
|
14
|
+
## [0.5.1] - 05/06/2016
|
|
15
|
+
### Added
|
|
16
|
+
- Functions with private names to avoid conflicts.
|
|
17
|
+
|
|
18
|
+
## [0.5.0] - 05/06/2016
|
|
19
|
+
### Added
|
|
20
|
+
- Fix for `Undefined operation: "#px times 0".` error.
|
|
21
|
+
|
|
22
|
+
## [0.4.0] - 04/25/2016
|
|
23
|
+
### Added
|
|
24
|
+
- Add `mq-get` function.
|
|
25
|
+
|
|
26
|
+
## [0.3.0] - 02/08/2016
|
|
27
|
+
### Added
|
|
28
|
+
- Support for `min-height` and `max-height`.
|
|
29
|
+
|
|
30
|
+
## [0.2.0] - 05/28/2015
|
|
31
|
+
- Public release.
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
|
|
3
|
+
The MIT License
|
|
4
|
+
|
|
5
|
+
Copyright © 2014–2016 [Jonathan Suh](https://jonsuh.com)
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the “Software”), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
# mq-sass
|
|
2
|
+
|
|
3
|
+
mq-sass is a Sass library to help you manage your responsive breakpoints and easily generate media queries.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Sass 3.3+
|
|
8
|
+
- SCSS syntax
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
1. mq-sass is available on [npm](https://www.npmjs.com/package/mq-sass), yarn and [Bower](http://bower.io/search/?q=mq-sass).
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
npm install mq-sass
|
|
16
|
+
|
|
17
|
+
yarn get mq-sass
|
|
18
|
+
|
|
19
|
+
bower install css-mq-sass
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Also available as a [Ruby gem](https://rubygems.org/gems/mq-sass) to use within your Rails application—see [below](#install-for-ruby-on-rails) for more information.
|
|
23
|
+
|
|
24
|
+
Or to manually install it, [download](https://github.com/jonsuh/mq-sass/archive/master.zip) and unzip the source files, then copy the files from the `stylesheets/mq-sass` directory into your project.
|
|
25
|
+
|
|
26
|
+
2. Import the `_mq-sass.scss` file into your project.
|
|
27
|
+
|
|
28
|
+
```scss
|
|
29
|
+
@import "mq-sass";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
If you're using gulp, Grunt, Compass, or alike, include mq-sass:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
// gulp-sass gulpfile.js
|
|
36
|
+
.pipe(sass({
|
|
37
|
+
includePaths: ['node_modules/mq-sass/stylesheets']
|
|
38
|
+
}))
|
|
39
|
+
|
|
40
|
+
// grunt-sass Gruntfile.js
|
|
41
|
+
options: {
|
|
42
|
+
includePaths: ['node_modules/mq-sass/stylesheets']
|
|
43
|
+
},
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```rb
|
|
47
|
+
# Compass config.rb
|
|
48
|
+
add_import_path "node_modules/mq-sass/stylesheets"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Install for Ruby on Rails
|
|
52
|
+
|
|
53
|
+
1. Add mq-sass to your Gemfile.
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
gem 'mq-sass'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. Run `bundle install`.
|
|
60
|
+
3. Include mq-sass by using Sass’s native `@import`*
|
|
61
|
+
|
|
62
|
+
```scss
|
|
63
|
+
// application.scss
|
|
64
|
+
@import "mq-sass";
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
\* [More information](https://blog.pivotal.io/pivotal-labs/labs/structure-your-sass-files-with-import) on why Sass’s native `@import` + why you should ditch Sprockets directives altogether.
|
|
68
|
+
|
|
69
|
+
## Documentation
|
|
70
|
+
|
|
71
|
+
### Settings
|
|
72
|
+
|
|
73
|
+
```scss
|
|
74
|
+
$mq-breakpoints: (
|
|
75
|
+
iphone : 320px,
|
|
76
|
+
iphone6 : 375px,
|
|
77
|
+
iphone6p: 414px,
|
|
78
|
+
small : 480px,
|
|
79
|
+
medium : 640px,
|
|
80
|
+
ipad : 768px,
|
|
81
|
+
large : 1024px,
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
$mq-ems : false;
|
|
85
|
+
$mq-em-base: 16px;
|
|
86
|
+
|
|
87
|
+
$mq-only: "only screen";
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### `mq($breakpoint, $minmax, $widthheight)` Mixin
|
|
91
|
+
|
|
92
|
+
```scss
|
|
93
|
+
@include mq($breakpoint, $minmax, $widthheight) { // $minmax and $widthheight are optional
|
|
94
|
+
// Sass goes here
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### `$breakpoint`
|
|
99
|
+
|
|
100
|
+
1. The first parameter, `$breakpoint`, accepts pre-defined values from the `$mq-breakpoints();` map, which is set by default as above in Settings.
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
|
|
104
|
+
```scss
|
|
105
|
+
@include mq(small) {
|
|
106
|
+
color: white;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```css
|
|
111
|
+
/* Resulting CSS */
|
|
112
|
+
@media only screen and (min-width: 480px) {
|
|
113
|
+
color: white;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
You can also customize your own breakpoints.
|
|
118
|
+
|
|
119
|
+
```scss
|
|
120
|
+
$mq-breakpoints: (
|
|
121
|
+
s : 600px,
|
|
122
|
+
m : 800px,
|
|
123
|
+
l : 1000px,
|
|
124
|
+
xl: 1200px,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
@include mq(xl) {
|
|
128
|
+
color: blue;
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
2. `$breakpoint` also accepts other pre-defined values:
|
|
133
|
+
|
|
134
|
+
- portrait
|
|
135
|
+
- landscape
|
|
136
|
+
- retina
|
|
137
|
+
|
|
138
|
+
Example:
|
|
139
|
+
|
|
140
|
+
```scss
|
|
141
|
+
@include mq(portrait) {
|
|
142
|
+
color: white;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@include mq(retina) {
|
|
146
|
+
color: red;
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```css
|
|
151
|
+
/* Resulting CSS */
|
|
152
|
+
@media only screen and (orientation: portrait) {
|
|
153
|
+
color: white;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 2dppx) {
|
|
157
|
+
color: red;
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
3. `$breakpoint` accepts custom values in px.
|
|
162
|
+
|
|
163
|
+
Example:
|
|
164
|
+
|
|
165
|
+
```scss
|
|
166
|
+
@include mq(700px) {
|
|
167
|
+
color: white;
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```css
|
|
172
|
+
/* Resulting CSS */
|
|
173
|
+
@media only screen and (min-width: 700px) {
|
|
174
|
+
color: white;
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Note:** You can also use unitless pixel values: `@include mq(700) {}`
|
|
179
|
+
|
|
180
|
+
#### `$minmax`
|
|
181
|
+
|
|
182
|
+
By default, media queries are mobile first (`min-width`).
|
|
183
|
+
|
|
184
|
+
`$minmax` accepts values `min` or `max`, which will result in `min-width:` or `max-width:` respectively. If left blank, it falls back to the default, `min`.
|
|
185
|
+
|
|
186
|
+
Example:
|
|
187
|
+
|
|
188
|
+
```scss
|
|
189
|
+
@include mq(ipad) {
|
|
190
|
+
color: white;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@include mq(600px, max) {
|
|
194
|
+
color: cyan;
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
```css
|
|
199
|
+
/* Resulting CSS */
|
|
200
|
+
@media only screen and (min-width: 768px) {
|
|
201
|
+
color: white;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@media only screen and (max-width: 600px) {
|
|
205
|
+
color: cyan;
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### `$widthheight`
|
|
210
|
+
|
|
211
|
+
By default, media queries that are generated are (`min/max-width`).
|
|
212
|
+
|
|
213
|
+
`$widthheight` accepts values `width` or `height`, which results in `min/max-width:` or `min/max-height:` respectively. If left blank, it falls back to the default, `width`.
|
|
214
|
+
|
|
215
|
+
Example:
|
|
216
|
+
|
|
217
|
+
```scss
|
|
218
|
+
@include mq(small, min, height) {
|
|
219
|
+
color: cyan;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@include mq(600px, max, height) {
|
|
223
|
+
color: pink;
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
```css
|
|
228
|
+
/* Resulting CSS */
|
|
229
|
+
@media only screen and (min-height: 480px) {
|
|
230
|
+
color: cyan;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@media only screen and (max-height: 600px) {
|
|
234
|
+
color: pink;
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### ems
|
|
239
|
+
|
|
240
|
+
To have media queries in ems, set `$mq-ems: true;`. The default em base is `16px`. You can change it by setting `$mq-em-base` to the pixel value of your choosing.
|
|
241
|
+
|
|
242
|
+
Examples:
|
|
243
|
+
|
|
244
|
+
```scss
|
|
245
|
+
$mq-ems: true;
|
|
246
|
+
|
|
247
|
+
@include mq(600px) {
|
|
248
|
+
color: white;
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```css
|
|
253
|
+
/* Resulting CSS */
|
|
254
|
+
@media only screen and (min-width: 37.5em) {
|
|
255
|
+
color: white;
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
```scss
|
|
260
|
+
$mq-ems : true;
|
|
261
|
+
$mq-em-base: 20px;
|
|
262
|
+
|
|
263
|
+
@include mq(600px) {
|
|
264
|
+
color: cyan;
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
```css
|
|
269
|
+
/* Resulting CSS */
|
|
270
|
+
@media only screen and (min-width: 30em) {
|
|
271
|
+
color: cyan;
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
#### media
|
|
276
|
+
|
|
277
|
+
By default the media is specified for `only screen`. For some reason if you'd like to change it or remove it completely, you can do so by changing the setting `$mq-media`:
|
|
278
|
+
|
|
279
|
+
```scss
|
|
280
|
+
$mq-media: "screen";
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
```css
|
|
284
|
+
/* Resulting CSS */
|
|
285
|
+
@media screen and (min-width...) {}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
```scss
|
|
289
|
+
$mq-media: ""; // or false
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
```css
|
|
293
|
+
/* Resulting CSS */
|
|
294
|
+
@media (min-width...) {}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### `mq-get($breakpoint, $ems)` function
|
|
298
|
+
|
|
299
|
+
Returns the value of the breakpoint in pixels (by default) or ems.
|
|
300
|
+
|
|
301
|
+
```scss
|
|
302
|
+
.example {
|
|
303
|
+
max-width: mq-get(small);
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
#### `$breakpoint`
|
|
308
|
+
|
|
309
|
+
`$breakpoint` accepts only pre-defined keys from the `$mq-breakpoints();` map.
|
|
310
|
+
|
|
311
|
+
```scss
|
|
312
|
+
$mq-breakpoints: (
|
|
313
|
+
small : 480px,
|
|
314
|
+
medium: 640px,
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
.example {
|
|
318
|
+
max-width: mq-get(small);
|
|
319
|
+
}
|
|
320
|
+
.example2 {
|
|
321
|
+
max-width: mq-get(medium);
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
```css
|
|
326
|
+
/* Resulting CSS */
|
|
327
|
+
.example {
|
|
328
|
+
max-width: 480px;
|
|
329
|
+
}
|
|
330
|
+
.example2 {
|
|
331
|
+
max-width: 640px;
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
#### `$ems`
|
|
336
|
+
|
|
337
|
+
`$ems` is a boolean (`false` or `true`, `false` by default) and dictates whether or not the return is in pixels or ems.
|
|
338
|
+
|
|
339
|
+
```scss
|
|
340
|
+
.example {
|
|
341
|
+
max-width: mq-get(small);
|
|
342
|
+
}
|
|
343
|
+
.example-ems {
|
|
344
|
+
max-width: mq-get(small, true);
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
```css
|
|
349
|
+
/* Resulting CSS */
|
|
350
|
+
.example {
|
|
351
|
+
max-width: 480px;
|
|
352
|
+
}
|
|
353
|
+
.example2 {
|
|
354
|
+
max-width: 30em;
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Notes
|
|
359
|
+
|
|
360
|
+
<b id="f1">1</b>. Requires [Node.js](https://nodejs.org/) [↩](#a1)
|
|
361
|
+
|
|
362
|
+
<b id="f2">2</b>. Also available on [Bower](http://bower.io/search/?q=mq-sass) [↩](#a2)
|
|
363
|
+
|
|
364
|
+
## License
|
|
365
|
+
|
|
366
|
+
The MIT License
|
|
367
|
+
|
|
368
|
+
Copyright © 2014–2016 [Jonathan Suh](https://jonsuh.com) ([@jonsuh](https://twitter.com/jonsuh))
|
|
369
|
+
|
|
370
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
371
|
+
of this software and associated documentation files (the “Software”), to deal
|
|
372
|
+
in the Software without restriction, including without limitation the rights
|
|
373
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
374
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
375
|
+
furnished to do so, subject to the following conditions:
|
|
376
|
+
|
|
377
|
+
The above copyright notice and this permission notice shall be included in
|
|
378
|
+
all copies or substantial portions of the Software.
|
|
379
|
+
|
|
380
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
381
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
382
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
383
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
384
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
385
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
386
|
+
THE SOFTWARE.
|
data/bower.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mq-sass",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Sass library to manage responsive breakpoints and generate to media queries",
|
|
5
|
+
"homepage": "https://github.com/jonsuh/mq-sass",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Jonathan Suh",
|
|
9
|
+
"email": "hello@jonsuh.com",
|
|
10
|
+
"url": "https://jonsuh.com"
|
|
11
|
+
},
|
|
12
|
+
"main": "stylesheets/_mq.scss",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"breakpoints",
|
|
15
|
+
"css",
|
|
16
|
+
"sass",
|
|
17
|
+
"scss",
|
|
18
|
+
"media query",
|
|
19
|
+
"media queries",
|
|
20
|
+
"responsive"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/jonsuh/mq-sass.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/jonsuh/mq-sass/issues"
|
|
28
|
+
},
|
|
29
|
+
"ignore": [
|
|
30
|
+
"**/.*",
|
|
31
|
+
"node_modules",
|
|
32
|
+
"bower_components",
|
|
33
|
+
"test",
|
|
34
|
+
"tests",
|
|
35
|
+
"Gemfile",
|
|
36
|
+
"mq-sass.gemspec",
|
|
37
|
+
"lib"
|
|
38
|
+
]
|
|
39
|
+
}
|
data/eyeglass-exports.js
ADDED
data/index.js
ADDED
data/lib/mq-sass.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Derived from https://github.com/thoughtbot/bourbon/blob/v4-stable/lib/bourbon.rb
|
|
2
|
+
# Special thanks to the thoughtbot team b/c I had no clue what I was doing
|
|
3
|
+
dir = File.dirname(__FILE__)
|
|
4
|
+
$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
|
5
|
+
|
|
6
|
+
unless defined?(Sass)
|
|
7
|
+
require 'sass'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
module MQSass
|
|
11
|
+
if defined?(Rails) && defined?(Rails::Engine)
|
|
12
|
+
class Engine < ::Rails::Engine
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
mqsass_path = File.expand_path("../../_sass/mq-sass", __FILE__)
|
|
18
|
+
ENV["SASS_PATH"] = [ENV["SASS_PATH"], mqsass_path].compact.join(File::PATH_SEPARATOR)
|
|
19
|
+
end
|
data/mq-sass.gemspec
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
2
|
+
require "mq-sass/version"
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |spec|
|
|
5
|
+
spec.name = "mq-sass"
|
|
6
|
+
spec.version = MQSass::VERSION
|
|
7
|
+
spec.platform = Gem::Platform::RUBY
|
|
8
|
+
spec.authors = ["Jonathan Suh"]
|
|
9
|
+
spec.email = ["hello@jonsuh.com"]
|
|
10
|
+
spec.homepage = "https://github.com/jonsuh/mq-sass"
|
|
11
|
+
spec.summary = "Sass library to manage responsive breakpoints"
|
|
12
|
+
spec.description = "Sass library to manage responsive breakpoints to generate media queries"
|
|
13
|
+
spec.license = "MIT"
|
|
14
|
+
|
|
15
|
+
spec.files = `git ls-files`.split("\n")
|
|
16
|
+
spec.require_paths = ["lib"]
|
|
17
|
+
end
|
data/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mq-sass",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Sass library to manage responsive breakpoints and generate to media queries",
|
|
5
|
+
"homepage": "https://github.com/jonsuh/mq-sass",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Jonathan Suh",
|
|
9
|
+
"email": "hello@jonsuh.com",
|
|
10
|
+
"url": "https://jonsuh.com"
|
|
11
|
+
},
|
|
12
|
+
"main": "index.js",
|
|
13
|
+
"eyeglass": {
|
|
14
|
+
"needs": "*",
|
|
15
|
+
"exports": "eyeglass-exports.js"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"breakpoints",
|
|
19
|
+
"css",
|
|
20
|
+
"sass",
|
|
21
|
+
"scss",
|
|
22
|
+
"media query",
|
|
23
|
+
"media queries",
|
|
24
|
+
"responsive"
|
|
25
|
+
],
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/jonsuh/mq-sass.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/jonsuh/mq-sass/issues"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// ==================================================
|
|
2
|
+
// Imports
|
|
3
|
+
// ==================================================
|
|
4
|
+
@import "mq-sass/settings.scss";
|
|
5
|
+
@import "mq-sass/functions.scss";
|
|
6
|
+
|
|
7
|
+
// ==================================================
|
|
8
|
+
// mq-get Function
|
|
9
|
+
// ==================================================
|
|
10
|
+
@function mq-get($breakpoint, $ems: false) {
|
|
11
|
+
@if map-has-key($mq-breakpoints, $breakpoint) {
|
|
12
|
+
$value: map-get($mq-breakpoints, $breakpoint);
|
|
13
|
+
|
|
14
|
+
@if $ems == true {
|
|
15
|
+
$value: _mq-em($value, $mq-em-base);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@return $value;
|
|
19
|
+
}
|
|
20
|
+
@else {
|
|
21
|
+
@error "Invalid breakpoint key. \a"
|
|
22
|
+
+ "It must be defined in the `$mq-breakpoints` map.";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ==================================================
|
|
27
|
+
// mq Mixin
|
|
28
|
+
// ==================================================
|
|
29
|
+
@mixin mq($breakpoint, $minmax: min, $widthheight: width) {
|
|
30
|
+
@if $breakpoint == landscape or $breakpoint == portrait or $breakpoint == retina or map-has-key($mq-breakpoints, $breakpoint) or type-of($breakpoint) == "number" {
|
|
31
|
+
$media: $mq-media + " and ";
|
|
32
|
+
$media-query: "";
|
|
33
|
+
|
|
34
|
+
@if ($media == false) {
|
|
35
|
+
$media: "";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@if $breakpoint == landscape or $breakpoint == portrait {
|
|
39
|
+
$media-query: "#{$media} (orientation: #{$breakpoint})";
|
|
40
|
+
}
|
|
41
|
+
@else if $breakpoint == retina {
|
|
42
|
+
$media-query: "#{$media} (-webkit-min-device-pixel-ratio: 2)," +
|
|
43
|
+
"#{$media} (min-resolution: 2dppx)";
|
|
44
|
+
}
|
|
45
|
+
@else {
|
|
46
|
+
@if $minmax != min and $minmax != max {
|
|
47
|
+
@warn "The second parameter of `mq()` only accepts value of `min` or `max`. \a"
|
|
48
|
+
+ "Falling back to the default, `min`.";
|
|
49
|
+
$minmax: min;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@if $widthheight != width and $widthheight != height {
|
|
53
|
+
@warn "The third parameter of `mq()` only accepts values of `width` or `height`. \a"
|
|
54
|
+
+ "Falling back to the default, `width`.";
|
|
55
|
+
$widthheight: width;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
$value: $breakpoint;
|
|
59
|
+
|
|
60
|
+
@if map-has-key($mq-breakpoints, $breakpoint) {
|
|
61
|
+
$value: map-get($mq-breakpoints, $breakpoint);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
$value: _mq-strip-units($value) * 1px;
|
|
65
|
+
|
|
66
|
+
@if ($mq-ems == true) {
|
|
67
|
+
$value: _mq-em($value, $mq-em-base);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
$media-query: "#{$media} (#{$minmax}-#{$widthheight}: #{$value})";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@media #{$media-query} {
|
|
74
|
+
@content;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
@else {
|
|
78
|
+
@warn "Invalid breakpoint value. \a"
|
|
79
|
+
+ "It must be defined in the `$mq-breakpoints` map, a valid CSS value, \a"
|
|
80
|
+
+ "or a predefined (e.g. retina, landscape, portrait).";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// ==================================================
|
|
2
|
+
// Functions
|
|
3
|
+
// ==================================================
|
|
4
|
+
|
|
5
|
+
// Strip units
|
|
6
|
+
// ==================================================
|
|
7
|
+
// Derived from Bourbon by thoughtbot (http://bourbon.io)
|
|
8
|
+
@function _mq-strip-units($val) {
|
|
9
|
+
@return ($val / ($val * 0 + 1));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Pixels to Ems
|
|
13
|
+
// ==================================================
|
|
14
|
+
// Derived from Bourbon by thoughtbot (http://bourbon.io)
|
|
15
|
+
@function _mq-em($pxval, $base: $mq-em-base) {
|
|
16
|
+
@if not unitless($pxval) {
|
|
17
|
+
$pxval: _mq-strip-units($pxval);
|
|
18
|
+
}
|
|
19
|
+
@if not unitless($base) {
|
|
20
|
+
$base: _mq-strip-units($base);
|
|
21
|
+
}
|
|
22
|
+
@return ($pxval / $base) * 1em;
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// ==================================================
|
|
2
|
+
// Settings
|
|
3
|
+
// ==================================================
|
|
4
|
+
|
|
5
|
+
// Ems
|
|
6
|
+
// ==================================================
|
|
7
|
+
$mq-ems : false !default;
|
|
8
|
+
$mq-em-base: 16px !default;
|
|
9
|
+
|
|
10
|
+
// Breakpoints
|
|
11
|
+
// ==================================================
|
|
12
|
+
$mq-breakpoints: (
|
|
13
|
+
iphone : 320px,
|
|
14
|
+
iphone6 : 375px,
|
|
15
|
+
iphone6p: 414px,
|
|
16
|
+
small : 480px,
|
|
17
|
+
medium : 640px,
|
|
18
|
+
ipad : 768px,
|
|
19
|
+
large : 1024px,
|
|
20
|
+
) !default;
|
|
21
|
+
|
|
22
|
+
// Breakpoints
|
|
23
|
+
// ==================================================
|
|
24
|
+
$mq-media: "only screen" !default;
|
metadata
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mq-sass
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.7.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jonathan Suh
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-12-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Sass library to manage responsive breakpoints to generate media queries
|
|
14
|
+
email:
|
|
15
|
+
- hello@jonsuh.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- ".editorconfig"
|
|
21
|
+
- ".gitignore"
|
|
22
|
+
- ".npmignore"
|
|
23
|
+
- CHANGELOG.md
|
|
24
|
+
- Gemfile
|
|
25
|
+
- LICENSE.md
|
|
26
|
+
- README.md
|
|
27
|
+
- bower.json
|
|
28
|
+
- eyeglass-exports.js
|
|
29
|
+
- index.js
|
|
30
|
+
- lib/mq-sass.rb
|
|
31
|
+
- lib/mq-sass/version.rb
|
|
32
|
+
- mq-sass.gemspec
|
|
33
|
+
- package.json
|
|
34
|
+
- stylesheets/_mq-sass.scss
|
|
35
|
+
- stylesheets/mq-sass/_functions.scss
|
|
36
|
+
- stylesheets/mq-sass/_settings.scss
|
|
37
|
+
homepage: https://github.com/jonsuh/mq-sass
|
|
38
|
+
licenses:
|
|
39
|
+
- MIT
|
|
40
|
+
metadata: {}
|
|
41
|
+
post_install_message:
|
|
42
|
+
rdoc_options: []
|
|
43
|
+
require_paths:
|
|
44
|
+
- lib
|
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '0'
|
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
requirements: []
|
|
56
|
+
rubyforge_project:
|
|
57
|
+
rubygems_version: 2.5.1
|
|
58
|
+
signing_key:
|
|
59
|
+
specification_version: 4
|
|
60
|
+
summary: Sass library to manage responsive breakpoints
|
|
61
|
+
test_files: []
|