sass-mq 4.0.2 → 6.0.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.
- package/CHANGELOG.md +45 -0
- package/LICENSE.md +1 -1
- package/README.md +208 -159
- package/_mq.import.scss +2 -0
- package/_mq.scss +172 -211
- package/package.json +12 -15
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
|
+
|
|
8
|
+
<!-- ## Unreleased -->
|
|
9
|
+
|
|
10
|
+
## v6.0.0 - 2022-01-10
|
|
11
|
+
|
|
12
|
+
This is a major version bump that contains breaking changes. It adds support for the [new Sass module system](https://sass-lang.com/blog/the-module-system-is-launched), drops support for Eyeglass, and drops support for deprecated versions of Sass. No new features were added.
|
|
13
|
+
|
|
14
|
+
See the updated [README](https://github.com/sass-mq/sass-mq/blob/main/README.md) for instructions on how to use this new version of Sass MQ.
|
|
15
|
+
|
|
16
|
+
🙌 A huge thanks to [Rodrigo](https://github.com/area73) for his contribution on this major release.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Support for dart-sass >= 1.35.1
|
|
21
|
+
- Test suite using [Jest](https://jestjs.io/) and [True](https://www.oddbird.net/true/), a unit-testing framework designed specifically for the Sass language
|
|
22
|
+
|
|
23
|
+
### Removed
|
|
24
|
+
|
|
25
|
+
- Dropped tests for Sass engines other than dart-sass
|
|
26
|
+
- Dropped support for [Eyeglass](https://github.com/linkedin/eyeglass)
|
|
27
|
+
- Dropped deprecated var `$mq-base-font-size` (https://github.com/sass-mq/sass-mq/pull/123)
|
|
28
|
+
- Dropped compatibility with browsers that don’t support media queries:
|
|
29
|
+
- Removed `$mq-responsive`
|
|
30
|
+
- Removed `$mq-static-breakpoint`
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Divisions are now performed with `sass:math.div(...)` instead of `/`
|
|
35
|
+
- `get-breakpoint-width`: added `@return null` when no breakpoint could be found (a function must always return something, or Sass will throw an error).
|
|
36
|
+
- Updated all `map-*` global functions in favor of the built-in module `map.*` (for example: `map-keys()` ➡️ `map.keys()`).
|
|
37
|
+
- `px2em`: removed param `$base-font-size` (deprecated in v5.0.1), and use 16px instead.
|
|
38
|
+
- Removed usage of `unit()` in favor of [`math.compatible()`](https://sass-lang.com/documentation/modules/math#compatible), as the `unit()` function is intended for debugging, and its output format is not guaranteed to be consistent across Sass versions or implementations.
|
|
39
|
+
- Updated all other global Sass functions to use their module equivalents (for example: `map-merge` ➡️ `map.merge`, `append` ➡️ `list.append`)
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
## Changes prior to v6.0.0
|
|
44
|
+
|
|
45
|
+
Changes prior to v6.0.0 were logged in https://github.com/sass-mq/sass-mq/releases
|
package/LICENSE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2013-
|
|
1
|
+
Copyright (c) 2013-2018 Guardian Media Group and contributors
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img width="500" height="500" src="https://avatars3.githubusercontent.com/u/9341289?v=3&s=500" alt="Awesome">
|
|
3
|
+
</div>
|
|
2
4
|
|
|
3
|
-
](https://travis-ci.org/sass-mq/sass-mq)
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`mq()` is a [Sass](http://sass-lang.com/ "Sass - Syntactically Awesome
|
|
8
|
-
Stylesheets") mixin that helps you compose media queries in an elegant
|
|
9
|
-
way.
|
|
7
|
+
`mq()` is a [Sass](http://sass-lang.com/ 'Sass - Syntactically Awesome
|
|
8
|
+
Stylesheets') mixin that helps you compose media queries in an elegant way.
|
|
10
9
|
|
|
11
10
|
- compiles keywords and `px`/`em` values to `em`-based queries ([a good thing](http://css-tricks.com/zooming-squishes))
|
|
12
|
-
-
|
|
11
|
+
- For version 6 and up we removed fallbacks for older browsers (see [Mobile-first Responsive Web Design and IE8](http://www.theguardian.com/info/developer-blog/2013/oct/14/mobile-first-responsive-ie8) on the Guardian's developer blog).
|
|
13
12
|
|
|
14
13
|
Here is a very basic example:
|
|
15
14
|
|
|
16
15
|
```scss
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
@use 'mq' as * with (
|
|
17
|
+
$breakpoints: (
|
|
18
|
+
mobile: 320px,
|
|
19
|
+
tablet: 740px,
|
|
20
20
|
desktop: 980px,
|
|
21
|
-
wide:
|
|
21
|
+
wide: 1300px,
|
|
22
|
+
)
|
|
22
23
|
);
|
|
23
24
|
|
|
24
|
-
@import 'mq';
|
|
25
|
-
|
|
26
25
|
.foo {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
@include mq($from: mobile, $until: tablet) {
|
|
27
|
+
background: red;
|
|
28
|
+
}
|
|
29
|
+
@include mq($from: tablet) {
|
|
30
|
+
background: green;
|
|
31
|
+
}
|
|
33
32
|
}
|
|
34
33
|
```
|
|
35
34
|
|
|
@@ -50,177 +49,202 @@ Compiles to:
|
|
|
50
49
|
|
|
51
50
|
_Sass MQ was crafted in-house at the Guardian. Today, many more companies and developers are using it in their projects: [see who uses Sass MQ](#who-uses-sass-mq)._
|
|
52
51
|
|
|
53
|
-
----
|
|
54
|
-
|
|
55
|
-
|
|
56
52
|
## How to use it
|
|
57
53
|
|
|
58
|
-
Immediately play with it on [SassMeister](http://sassmeister.com/): `@
|
|
54
|
+
Immediately play with it on [SassMeister](http://sassmeister.com/): `@use 'mq';`.
|
|
59
55
|
|
|
60
56
|
OR:
|
|
61
57
|
|
|
62
|
-
1. Install
|
|
58
|
+
1. Install:
|
|
63
59
|
|
|
64
|
-
|
|
60
|
+
- with [Bower](http://bower.io/ 'Bower: A package manager for the web'): `bower install sass-mq --save`
|
|
61
|
+
- with [npm](https://www.npmjs.com/): `npm install sass-mq --save`
|
|
62
|
+
- with [yarn](https://www.yarnpkg.com/): `yarn add sass-mq`
|
|
65
63
|
|
|
66
|
-
|
|
64
|
+
OR [Download \_mq.scss](https://raw.github.com/sass-mq/sass-mq/main/_mq.scss) into your Sass project.
|
|
67
65
|
|
|
68
66
|
2. Import the partial in your Sass files and override default settings
|
|
69
|
-
with your own preferences
|
|
70
|
-
```scss
|
|
71
|
-
// To enable support for browsers that do not support @media queries,
|
|
72
|
-
// (IE <= 8, Firefox <= 3, Opera <= 9) set $mq-responsive to false
|
|
73
|
-
// Create a separate stylesheet served exclusively to these browsers,
|
|
74
|
-
// meaning @media queries will be rasterized, relying on the cascade itself
|
|
75
|
-
$mq-responsive: true;
|
|
76
|
-
|
|
77
|
-
// Name your breakpoints in a way that creates a ubiquitous language
|
|
78
|
-
// across team members. It will improve communication between
|
|
79
|
-
// stakeholders, designers, developers, and testers.
|
|
80
|
-
$mq-breakpoints: (
|
|
81
|
-
mobile: 320px,
|
|
82
|
-
tablet: 740px,
|
|
83
|
-
desktop: 980px,
|
|
84
|
-
wide: 1300px,
|
|
85
|
-
|
|
86
|
-
// Tweakpoints
|
|
87
|
-
desktopAd: 810px,
|
|
88
|
-
mobileLandscape: 480px
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
// Define the breakpoint from the $mq-breakpoints list that should
|
|
92
|
-
// be used as the target width when outputting a static stylesheet
|
|
93
|
-
// (i.e. when $mq-responsive is set to 'false').
|
|
94
|
-
$mq-static-breakpoint: desktop;
|
|
95
|
-
|
|
96
|
-
// If you want to display the currently active breakpoint in the top
|
|
97
|
-
// right corner of your site during development, add the breakpoints
|
|
98
|
-
// to this list, ordered by width, e.g. (mobile, tablet, desktop).
|
|
99
|
-
$mq-show-breakpoints: (mobile, mobileLandscape, tablet, desktop, wide);
|
|
100
|
-
|
|
101
|
-
@import 'path/to/mq';
|
|
102
|
-
// With eyeglass:
|
|
103
|
-
// @import 'sass-mq';
|
|
104
|
-
```
|
|
105
|
-
3. Play around with `mq()` (see below)
|
|
67
|
+
with your own preferences:
|
|
106
68
|
|
|
107
|
-
|
|
69
|
+
```scss
|
|
70
|
+
// Name your breakpoints in a way that creates a ubiquitous language
|
|
71
|
+
// across team members. It will improve communication between
|
|
72
|
+
// stakeholders, designers, developers, and testers.
|
|
73
|
+
$breakpoints: (
|
|
74
|
+
mobile: 320px,
|
|
75
|
+
tablet: 740px,
|
|
76
|
+
desktop: 980px,
|
|
77
|
+
wide: 1300px,
|
|
78
|
+
// Tweakpoints
|
|
79
|
+
desktopAd: 810px,
|
|
80
|
+
mobileLandscape: 480px,
|
|
81
|
+
);
|
|
108
82
|
|
|
109
|
-
|
|
83
|
+
// If you want to display the currently active breakpoint in the top
|
|
84
|
+
// right corner of your site during development, add the breakpoints
|
|
85
|
+
// to this list, ordered by width. For examples: (mobile, tablet, desktop).
|
|
86
|
+
$show-breakpoints: (mobile, mobileLandscape, tablet, desktop, wide);
|
|
110
87
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
-
|
|
88
|
+
@use 'path/to/mq' with (
|
|
89
|
+
$breakpoints: $breakpoints,
|
|
90
|
+
$show-breakpoints: $show-breakpoints
|
|
91
|
+
);
|
|
92
|
+
```
|
|
114
93
|
|
|
115
|
-
|
|
94
|
+
### Notes about `@use` Vs `@import`
|
|
95
|
+
|
|
96
|
+
When using the `@use` directive, you have to change your mindset when working with vars,
|
|
97
|
+
functions or mixins and how they are now seen by Sass.
|
|
98
|
+
|
|
99
|
+
Previously, with the `@import` statement any var, function, or mixin were exposed in the global scope.
|
|
100
|
+
That means that you could define a var like `$mq-media-type: all` in your main sass file and use
|
|
101
|
+
it anywhere as long as the main file had been loaded previously.
|
|
102
|
+
|
|
103
|
+
This was possible because vars, functions, and mixins were set in the global scope.
|
|
104
|
+
|
|
105
|
+
One drawback of this behaviour was that we needed to ensure not to pollute the global scope
|
|
106
|
+
with common names or names that may be already taken by any other library.
|
|
107
|
+
|
|
108
|
+
To solve this matter, we mostly used a prefix in vars, functions, or mixins in order to avoid
|
|
109
|
+
collapsing names.
|
|
110
|
+
|
|
111
|
+
Now with the new `@use` directive, no var, function, or mixin is placed in global scope, and they are
|
|
112
|
+
all scoped within the file.
|
|
113
|
+
|
|
114
|
+
That means that we explicitly need to include the partial file in each file that may use its vars,
|
|
115
|
+
functions or mixins (similar to ES6 import modules).
|
|
116
|
+
|
|
117
|
+
So, previously we could have a typical setup like this:
|
|
116
118
|
|
|
117
119
|
```scss
|
|
118
|
-
.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
120
|
+
// main.scss
|
|
121
|
+
@import 'mq';
|
|
122
|
+
@import 'typography';
|
|
123
|
+
@import 'layout';
|
|
124
|
+
@include mq($from:tablet) {
|
|
125
|
+
...
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
...
|
|
129
|
+
|
|
130
|
+
// typography.scss
|
|
131
|
+
@include mq($from:tablet) {
|
|
132
|
+
...
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Now, you will need to explicitly import the `_mq.scss` file in each file that needs to use any var, function
|
|
138
|
+
or mixin from it:
|
|
139
|
+
|
|
140
|
+
```scss
|
|
141
|
+
// main.scss
|
|
142
|
+
@use 'mq';
|
|
143
|
+
@use 'typography';
|
|
144
|
+
@use 'layout';
|
|
145
|
+
@include mq.mq($from:tablet) {
|
|
146
|
+
...
|
|
147
|
+
}
|
|
148
|
+
...
|
|
149
|
+
|
|
150
|
+
// typography.scss
|
|
151
|
+
@use 'mq';
|
|
152
|
+
@include mq.mq($from:tablet) {
|
|
153
|
+
...
|
|
135
154
|
}
|
|
136
155
|
```
|
|
137
156
|
|
|
138
|
-
|
|
157
|
+
Other important things about `@use`:
|
|
158
|
+
|
|
159
|
+
- The file is only imported once, no matter how many times you @use it in a project.
|
|
139
160
|
|
|
140
|
-
|
|
141
|
-
|
|
161
|
+
- Variables, mixins, and functions (what Sass calls “members”) that start with an underscore (\_)
|
|
162
|
+
or hyphen (-) are considered private, and not imported.
|
|
142
163
|
|
|
143
|
-
|
|
144
|
-
|
|
164
|
+
- Members from the used file are only made available locally, but not passed along to future
|
|
165
|
+
imports.
|
|
145
166
|
|
|
146
|
-
|
|
147
|
-
|
|
167
|
+
- Similarly, `@extends` will only apply up the chain; extending selectors in imported files,
|
|
168
|
+
but not extending files that import this one.
|
|
148
169
|
|
|
149
|
-
|
|
150
|
-
older browsers typically run on, set `$mq-static-breakpoint` to match
|
|
151
|
-
a breakpoint from the `$mq-breakpoints` list. The default is
|
|
152
|
-
`desktop`.
|
|
170
|
+
- All imported members are namespaced by default.
|
|
153
171
|
|
|
154
|
-
|
|
155
|
-
|
|
172
|
+
Please see [introducing-sass-modules](https://css-tricks.com/introducing-sass-modules/) for more
|
|
173
|
+
info about sass modules.
|
|
174
|
+
|
|
175
|
+
3. Play around with `mq()` (see below)
|
|
176
|
+
|
|
177
|
+
### Responsive mode
|
|
178
|
+
|
|
179
|
+
`mq()` takes up to three optional parameters:
|
|
180
|
+
|
|
181
|
+
- `$from`: _inclusive_ `min-width` boundary
|
|
182
|
+
- `$until`: _exclusive_ `max-width` boundary
|
|
183
|
+
- `$and`: additional custom directives
|
|
184
|
+
|
|
185
|
+
Note that `$until` as a keyword is a hard limit i.e. it's breakpoint - 1.
|
|
156
186
|
|
|
157
187
|
```scss
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
@include mq($until: tablet, $and: '(orientation: landscape)') {
|
|
178
|
-
color: crimson;
|
|
179
|
-
}
|
|
180
|
-
@include mq(mobile, desktop) {
|
|
181
|
-
color: firebrick;
|
|
182
|
-
}
|
|
188
|
+
@use 'mq';
|
|
189
|
+
|
|
190
|
+
.responsive {
|
|
191
|
+
// Apply styling to mobile and upwards
|
|
192
|
+
@include mq.mq($from: mobile) {
|
|
193
|
+
color: red;
|
|
194
|
+
}
|
|
195
|
+
// Apply styling up to devices smaller than tablets (exclude tablets)
|
|
196
|
+
@include mq.mq($until: tablet) {
|
|
197
|
+
color: blue;
|
|
198
|
+
}
|
|
199
|
+
// Same thing, in landscape orientation
|
|
200
|
+
@include mq.mq($until: tablet, $and: '(orientation: landscape)') {
|
|
201
|
+
color: hotpink;
|
|
202
|
+
}
|
|
203
|
+
// Apply styling to tablets up to desktop (exclude desktop)
|
|
204
|
+
@include mq.mq(tablet, desktop) {
|
|
205
|
+
color: green;
|
|
206
|
+
}
|
|
183
207
|
}
|
|
184
208
|
```
|
|
185
209
|
|
|
186
|
-
### Verbose and
|
|
210
|
+
### Verbose and shorthand notations
|
|
187
211
|
|
|
188
|
-
Sometimes you’ll want to be extra verbose (
|
|
212
|
+
Sometimes you’ll want to be extra verbose (for example, if you’re developing a
|
|
189
213
|
library based on top of sass-mq), however for readability in a codebase,
|
|
190
214
|
the shorthand notation is recommended.
|
|
191
215
|
|
|
192
|
-
All of these examples output the exact same thing
|
|
193
|
-
reference so you can use the notation that best matches your needs:
|
|
216
|
+
All of these examples output the exact same thing and are here for
|
|
217
|
+
reference, so you can use the notation that best matches your needs:
|
|
194
218
|
|
|
195
219
|
```scss
|
|
220
|
+
@use 'mq';
|
|
196
221
|
// Verbose
|
|
197
|
-
@include mq(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
222
|
+
@include mq.mq(
|
|
223
|
+
$from: false,
|
|
224
|
+
$until: desktop,
|
|
225
|
+
$and: false,
|
|
226
|
+
$media-type: $media-type // defaults to 'all'
|
|
202
227
|
) {
|
|
203
|
-
|
|
228
|
+
.foo {
|
|
229
|
+
}
|
|
204
230
|
}
|
|
205
231
|
|
|
206
232
|
// Omitting argument names
|
|
207
|
-
@include mq(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
false,
|
|
211
|
-
$mq-media-type
|
|
212
|
-
) {
|
|
213
|
-
.foo {}
|
|
233
|
+
@include mq.mq(false, desktop, false, $media-type) {
|
|
234
|
+
.foo {
|
|
235
|
+
}
|
|
214
236
|
}
|
|
215
237
|
|
|
216
238
|
// Omitting tailing arguments
|
|
217
239
|
@include mq(false, desktop) {
|
|
218
|
-
|
|
240
|
+
.foo {
|
|
241
|
+
}
|
|
219
242
|
}
|
|
220
243
|
|
|
221
244
|
// Recommended
|
|
222
245
|
@include mq($until: desktop) {
|
|
223
|
-
|
|
246
|
+
.foo {
|
|
247
|
+
}
|
|
224
248
|
}
|
|
225
249
|
```
|
|
226
250
|
|
|
@@ -229,39 +253,50 @@ reference so you can use the notation that best matches your needs:
|
|
|
229
253
|
### Adding custom breakpoints
|
|
230
254
|
|
|
231
255
|
```scss
|
|
232
|
-
@include
|
|
256
|
+
@include add-breakpoint(tvscreen, 1920px);
|
|
233
257
|
|
|
234
258
|
.hide-on-tv {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
259
|
+
@include mq(tvscreen) {
|
|
260
|
+
display: none;
|
|
261
|
+
}
|
|
238
262
|
}
|
|
239
263
|
```
|
|
240
264
|
|
|
241
265
|
### Seeing the currently active breakpoint
|
|
242
266
|
|
|
243
267
|
While developing, it can be nice to always know which breakpoint is
|
|
244
|
-
active. To achieve this, set the `$
|
|
268
|
+
active. To achieve this, set the `$show-breakpoints` variable to
|
|
245
269
|
be a list of the breakpoints you want to debug, ordered by width.
|
|
246
270
|
The name of the active breakpoint and its pixel and em values will
|
|
247
271
|
then be shown in the top right corner of the viewport.
|
|
248
272
|
|
|
249
|
-
|
|
273
|
+
```scss
|
|
274
|
+
// Adapt the list to include breakpoint names from your project
|
|
275
|
+
$show-breakpoints: (phone, phablet, tablet);
|
|
276
|
+
|
|
277
|
+
@use 'path/to/mq' with (
|
|
278
|
+
$show-breakpoints: $show-breakpoints
|
|
279
|
+
);
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+

|
|
250
283
|
|
|
251
284
|
### Changing media type
|
|
252
285
|
|
|
253
286
|
If you want to specify a media type, for example to output styles
|
|
254
|
-
for screens only, set `$
|
|
287
|
+
for screens only, set `$media-type`:
|
|
255
288
|
|
|
256
289
|
#### SCSS
|
|
257
290
|
|
|
258
291
|
```scss
|
|
259
|
-
|
|
292
|
+
@use 'mq' with (
|
|
293
|
+
$media-type: screen
|
|
294
|
+
);
|
|
260
295
|
|
|
261
296
|
.screen-only-element {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
297
|
+
@include mq.mq(mobile) {
|
|
298
|
+
width: 300px;
|
|
299
|
+
}
|
|
265
300
|
}
|
|
266
301
|
```
|
|
267
302
|
|
|
@@ -269,12 +304,23 @@ $mq-media-type: screen;
|
|
|
269
304
|
|
|
270
305
|
```css
|
|
271
306
|
@media screen and (max-width: 19.99em) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
307
|
+
.screen-only-element {
|
|
308
|
+
width: 300px;
|
|
309
|
+
}
|
|
275
310
|
}
|
|
276
311
|
```
|
|
277
312
|
|
|
313
|
+
### Implementing sass-mq in your project
|
|
314
|
+
|
|
315
|
+
Please see the `examples` folder which contains a variety of examples on how to implement "sass-mq"
|
|
316
|
+
|
|
317
|
+
### Backward compatibility with `@import`
|
|
318
|
+
|
|
319
|
+
Just in case you need to have backward compatibility and want to use`@import` instead of `@use`,
|
|
320
|
+
you can do so by importing `_mq.import.scss` instead of `_mq.scss`.
|
|
321
|
+
|
|
322
|
+
Please see `legacy.scss` on `examples` folder.
|
|
323
|
+
|
|
278
324
|
## Running tests
|
|
279
325
|
|
|
280
326
|
```sh
|
|
@@ -332,9 +378,12 @@ These companies and projects use Sass MQ:
|
|
|
332
378
|
- [Hotelbeds Group](http://group.hotelbeds.com/)
|
|
333
379
|
- [Beneš & Michl](http://www.benes-michl.cz)
|
|
334
380
|
- [Manchester International Festival](http://mif.co.uk/)
|
|
381
|
+
- [Shopify Polaris](https://polaris.shopify.com)
|
|
382
|
+
- [Taylor / Thomas](https://www.taylorthomas.co.uk/)
|
|
383
|
+
- [GOV.UK Design System](https://design-system.service.gov.uk/)
|
|
335
384
|
- You? [Open an issue](https://github.com/sass-mq/sass-mq/issues/new?title=My%20company%20uses%20Sass%20MQ&body=Hi,%20we%27re%20using%20Sass%20MQ%20at%20[name%20of%20your%20company]%20and%20we%27d%20like%20to%20be%20mentionned%20in%20the%20README%20of%20the%20project.%20Cheers!)
|
|
336
385
|
|
|
337
|
-
|
|
386
|
+
---
|
|
338
387
|
|
|
339
388
|
Looking for a more advanced sass-mq, with support for height and other niceties?
|
|
340
389
|
Give [@mcaskill's fork of sass-mq](https://github.com/mcaskill/sass-mq) a try.
|
package/_mq.import.scss
ADDED
package/_mq.scss
CHANGED
|
@@ -1,27 +1,6 @@
|
|
|
1
|
-
@
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/// Base font size on the `<body>` element
|
|
5
|
-
/// @type Number (unit)
|
|
6
|
-
$mq-base-font-size: 16px !default;
|
|
7
|
-
|
|
8
|
-
/// Responsive mode
|
|
9
|
-
///
|
|
10
|
-
/// Set to `false` to enable support for browsers that do not support @media queries,
|
|
11
|
-
/// (IE <= 8, Firefox <= 3, Opera <= 9)
|
|
12
|
-
///
|
|
13
|
-
/// You could create a stylesheet served exclusively to older browsers,
|
|
14
|
-
/// where @media queries are rasterized
|
|
15
|
-
///
|
|
16
|
-
/// @example scss
|
|
17
|
-
/// // old-ie.scss
|
|
18
|
-
/// $mq-responsive: false;
|
|
19
|
-
/// @import 'main'; // @media queries in this file will be rasterized up to $mq-static-breakpoint
|
|
20
|
-
/// // larger breakpoints will be ignored
|
|
21
|
-
///
|
|
22
|
-
/// @type Boolean
|
|
23
|
-
/// @link https://github.com/sass-mq/sass-mq#responsive-mode-off Disabled responsive mode documentation
|
|
24
|
-
$mq-responsive: true !default;
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:list';
|
|
25
4
|
|
|
26
5
|
/// Breakpoint list
|
|
27
6
|
///
|
|
@@ -31,111 +10,100 @@ $mq-responsive: true !default;
|
|
|
31
10
|
///
|
|
32
11
|
/// @type Map
|
|
33
12
|
/// @link https://github.com/sass-mq/sass-mq#seeing-the-currently-active-breakpoint Full documentation and examples
|
|
34
|
-
$
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
13
|
+
$breakpoints: (
|
|
14
|
+
mobile: 320px,
|
|
15
|
+
tablet: 740px,
|
|
16
|
+
desktop: 980px,
|
|
17
|
+
wide: 1300px,
|
|
39
18
|
) !default;
|
|
40
19
|
|
|
41
|
-
/// Static breakpoint (for fixed-width layouts)
|
|
42
|
-
///
|
|
43
|
-
/// Define the breakpoint from $mq-breakpoints that should
|
|
44
|
-
/// be used as the target width for the fixed-width layout
|
|
45
|
-
/// (i.e. when $mq-responsive is set to 'false') in a old-ie.scss
|
|
46
|
-
///
|
|
47
|
-
/// @example scss
|
|
48
|
-
/// // tablet-only.scss
|
|
49
|
-
/// //
|
|
50
|
-
/// // Ignore all styles above tablet breakpoint,
|
|
51
|
-
/// // and fix the styles (e.g. layout) at tablet width
|
|
52
|
-
/// $mq-responsive: false;
|
|
53
|
-
/// $mq-static-breakpoint: tablet;
|
|
54
|
-
/// @import 'main'; // @media queries in this file will be rasterized up to tablet
|
|
55
|
-
/// // larger breakpoints will be ignored
|
|
56
|
-
///
|
|
57
|
-
/// @type String
|
|
58
|
-
/// @link https://github.com/sass-mq/sass-mq#adding-custom-breakpoints Full documentation and examples
|
|
59
|
-
$mq-static-breakpoint: desktop !default;
|
|
60
|
-
|
|
61
20
|
/// Show breakpoints in the top right corner
|
|
62
21
|
///
|
|
63
22
|
/// If you want to display the currently active breakpoint in the top
|
|
64
23
|
/// right corner of your site during development, add the breakpoints
|
|
65
|
-
/// to this list, ordered by width
|
|
24
|
+
/// to this list, ordered by width. For example: (mobile, tablet, desktop).
|
|
25
|
+
///
|
|
26
|
+
/// @example scss
|
|
27
|
+
/// @use 'path/to/mq' with ($show-breakpoints: ('mobile', 'tablet', 'desktop'));
|
|
28
|
+
///
|
|
66
29
|
///
|
|
67
30
|
/// @type map
|
|
68
|
-
$
|
|
31
|
+
$show-breakpoints: () !default;
|
|
69
32
|
|
|
70
|
-
/// Customize the media type (
|
|
33
|
+
/// Customize the media type (for example: `@media screen` or `@media print`)
|
|
71
34
|
/// By default sass-mq uses an "all" media type (`@media all and …`)
|
|
72
35
|
///
|
|
36
|
+
/// If you want to overried the media type, you can use this option.
|
|
37
|
+
/// @example scss
|
|
38
|
+
/// @use 'path/to/mq' with ($media-type: 'screen');
|
|
39
|
+
///
|
|
73
40
|
/// @type String
|
|
74
|
-
/// @link https://github.com/sass-mq/sass-mq#changing-media-type Full documentation and
|
|
75
|
-
$
|
|
41
|
+
/// @link https://github.com/sass-mq/sass-mq#changing-media-type Full documentation and example
|
|
42
|
+
$media-type: all !default;
|
|
76
43
|
|
|
77
44
|
/// Convert pixels to ems
|
|
78
45
|
///
|
|
79
46
|
/// @param {Number} $px - value to convert
|
|
80
|
-
/// @param {Number} $base-font-size ($mq-base-font-size) - `<body>` font size
|
|
81
47
|
///
|
|
82
48
|
/// @example scss
|
|
83
|
-
/// $font-size-in-ems:
|
|
84
|
-
/// p { font-size:
|
|
49
|
+
/// $font-size-in-ems: px2em(16px);
|
|
50
|
+
/// p { font-size: px2em(16px); }
|
|
85
51
|
///
|
|
86
|
-
/// @requires $mq-base-font-size
|
|
87
52
|
/// @returns {Number}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
53
|
+
|
|
54
|
+
@function px2em($px) {
|
|
55
|
+
@if math.is-unitless($px) {
|
|
56
|
+
@warn "Assuming #{$px} to be in pixels, attempting to convert it into pixels.";
|
|
57
|
+
@return px2em($px * 1px);
|
|
58
|
+
}
|
|
59
|
+
// if $px is compatible with em units, then return value unchanged
|
|
60
|
+
@if math.compatible($px, 1em) {
|
|
61
|
+
@return $px;
|
|
62
|
+
}
|
|
63
|
+
@return math.div($px, 16px) * 1em;
|
|
96
64
|
}
|
|
97
65
|
|
|
98
66
|
/// Get a breakpoint's width
|
|
99
67
|
///
|
|
100
|
-
/// @param {String} $name - Name of the breakpoint. One of $
|
|
68
|
+
/// @param {String} $name - Name of the breakpoint. One of $breakpoints
|
|
101
69
|
///
|
|
102
70
|
/// @example scss
|
|
103
|
-
/// $tablet-width:
|
|
104
|
-
/// @media (min-width:
|
|
71
|
+
/// $tablet-width: get-breakpoint-width(tablet);
|
|
72
|
+
/// @media (min-width: get-breakpoint-width(tablet)) {}
|
|
105
73
|
///
|
|
106
|
-
/// @requires {Variable} $
|
|
74
|
+
/// @requires {Variable} $breakpoints
|
|
107
75
|
///
|
|
108
76
|
/// @returns {Number} Value in pixels
|
|
109
|
-
@function
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
77
|
+
@function get-breakpoint-width($name, $breakpoints: $breakpoints) {
|
|
78
|
+
@if map.has-key($breakpoints, $name) {
|
|
79
|
+
@return map.get($breakpoints, $name);
|
|
80
|
+
} @else {
|
|
81
|
+
@warn "Breakpoint #{$name} wasn't found in $breakpoints.";
|
|
82
|
+
@return null;
|
|
83
|
+
}
|
|
115
84
|
}
|
|
116
85
|
|
|
117
86
|
/// Media Query mixin
|
|
118
87
|
///
|
|
119
|
-
/// @param {String | Boolean} $from
|
|
120
|
-
/// @param {String | Boolean} $until
|
|
121
|
-
/// @param {String | Boolean} $and
|
|
122
|
-
/// @param {String} $media-type
|
|
88
|
+
/// @param {String | Boolean} $from [false] - One of $breakpoints
|
|
89
|
+
/// @param {String | Boolean} $until [false] - One of $breakpoints
|
|
90
|
+
/// @param {String | Boolean} $and [false] - Additional media query parameters
|
|
91
|
+
/// @param {String} $media-type [$media-type] - Media type: screen, print…
|
|
123
92
|
///
|
|
124
93
|
/// @ignore Undocumented API, for advanced use only:
|
|
125
|
-
/// @ignore @param {Map} $breakpoints
|
|
126
|
-
/// @ignore @param {String} $static-breakpoint ($mq-static-breakpoint)
|
|
94
|
+
/// @ignore @param {Map} $breakpoints [$breakpoints]
|
|
127
95
|
///
|
|
128
96
|
/// @content styling rules, wrapped into a @media query when $responsive is true
|
|
129
97
|
///
|
|
130
|
-
/// @requires {Variable} $
|
|
131
|
-
/// @requires {Variable} $
|
|
132
|
-
/// @requires {
|
|
133
|
-
/// @requires {function}
|
|
134
|
-
/// @requires {function} mq-get-breakpoint-width
|
|
98
|
+
/// @requires {Variable} $media-type
|
|
99
|
+
/// @requires {Variable} $breakpoints
|
|
100
|
+
/// @requires {function} px2em
|
|
101
|
+
/// @requires {function} get-breakpoint-width
|
|
135
102
|
///
|
|
136
103
|
/// @link https://github.com/sass-mq/sass-mq#responsive-mode-on-default Full documentation and examples
|
|
137
104
|
///
|
|
138
105
|
/// @example scss
|
|
106
|
+
/// @use 'path/to/mq' as *;
|
|
139
107
|
/// .element {
|
|
140
108
|
/// @include mq($from: mobile) {
|
|
141
109
|
/// color: red;
|
|
@@ -157,75 +125,58 @@ $mq-media-type: all !default;
|
|
|
157
125
|
/// }
|
|
158
126
|
/// // Advanced use:
|
|
159
127
|
/// $my-breakpoints: (L: 900px, XL: 1200px);
|
|
160
|
-
/// @include mq(L, $breakpoints: $my-breakpoints
|
|
128
|
+
/// @include mq(L, $breakpoints: $my-breakpoints) {
|
|
161
129
|
/// color: hotpink;
|
|
162
130
|
/// }
|
|
163
131
|
/// }
|
|
164
132
|
@mixin mq(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
$responsive: $mq-responsive,
|
|
171
|
-
$static-breakpoint: $mq-static-breakpoint
|
|
133
|
+
$from: false,
|
|
134
|
+
$until: false,
|
|
135
|
+
$and: false,
|
|
136
|
+
$media-type: $media-type,
|
|
137
|
+
$breakpoints: $breakpoints
|
|
172
138
|
) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
// From: this breakpoint (inclusive)
|
|
178
|
-
@if $from {
|
|
179
|
-
@if type-of($from) == number {
|
|
180
|
-
$min-width: mq-px2em($from);
|
|
181
|
-
} @else {
|
|
182
|
-
$min-width: mq-px2em(mq-get-breakpoint-width($from, $breakpoints));
|
|
183
|
-
}
|
|
184
|
-
}
|
|
139
|
+
$min-width: 0;
|
|
140
|
+
$max-width: 0;
|
|
141
|
+
$media-query: '';
|
|
185
142
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
143
|
+
// From: this breakpoint (inclusive)
|
|
144
|
+
@if $from {
|
|
145
|
+
@if type-of($from) == number {
|
|
146
|
+
$min-width: px2em($from);
|
|
147
|
+
} @else {
|
|
148
|
+
$min-width: px2em(get-breakpoint-width($from, $breakpoints));
|
|
193
149
|
}
|
|
150
|
+
}
|
|
194
151
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
@if $
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
// Output only rules that start at or span our target width
|
|
202
|
-
@if (
|
|
203
|
-
$and == false
|
|
204
|
-
and $min-width <= $target-width
|
|
205
|
-
and (
|
|
206
|
-
$until == false or $max-width >= $target-width
|
|
207
|
-
)
|
|
208
|
-
) {
|
|
209
|
-
@content;
|
|
210
|
-
}
|
|
152
|
+
// Until: that breakpoint (exclusive)
|
|
153
|
+
@if $until {
|
|
154
|
+
@if type-of($until) == number {
|
|
155
|
+
$max-width: px2em($until);
|
|
156
|
+
} @else {
|
|
157
|
+
$max-width: px2em(get-breakpoint-width($until, $breakpoints)) - 0.01em;
|
|
211
158
|
}
|
|
159
|
+
}
|
|
212
160
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
161
|
+
@if $min-width != 0 {
|
|
162
|
+
$media-query: '#{$media-query} and (min-width: #{$min-width})';
|
|
163
|
+
}
|
|
164
|
+
@if $max-width != 0 {
|
|
165
|
+
$media-query: '#{$media-query} and (max-width: #{$max-width})';
|
|
166
|
+
}
|
|
167
|
+
@if $and {
|
|
168
|
+
$media-query: '#{$media-query} and #{$and}';
|
|
169
|
+
}
|
|
218
170
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
171
|
+
// Remove unnecessary media query prefix 'all and '
|
|
172
|
+
@if ($media-type == 'all' and $media-query != '') {
|
|
173
|
+
$media-type: '';
|
|
174
|
+
$media-query: str-slice(unquote($media-query), 6);
|
|
175
|
+
}
|
|
224
176
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
177
|
+
@media #{$media-type + $media-query} {
|
|
178
|
+
@content;
|
|
179
|
+
}
|
|
229
180
|
}
|
|
230
181
|
|
|
231
182
|
/// Quick sort
|
|
@@ -234,28 +185,28 @@ $mq-media-type: all !default;
|
|
|
234
185
|
/// @access private
|
|
235
186
|
/// @param {List} $list - List to sort
|
|
236
187
|
/// @returns {List} Sorted List
|
|
237
|
-
@function
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
188
|
+
@function _quick-sort($list) {
|
|
189
|
+
$less: ();
|
|
190
|
+
$equal: ();
|
|
191
|
+
$large: ();
|
|
241
192
|
|
|
242
|
-
|
|
243
|
-
|
|
193
|
+
@if length($list) > 1 {
|
|
194
|
+
$seed: list.nth($list, math.ceil(math.div(length($list), 2)));
|
|
244
195
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
@return join(join(_mq-quick-sort($less), $equal), _mq-quick-sort($large));
|
|
196
|
+
@each $item in $list {
|
|
197
|
+
@if ($item == $seed) {
|
|
198
|
+
$equal: list.append($equal, $item);
|
|
199
|
+
} @else if ($item < $seed) {
|
|
200
|
+
$less: list.append($less, $item);
|
|
201
|
+
} @else if ($item > $seed) {
|
|
202
|
+
$large: list.append($large, $item);
|
|
203
|
+
}
|
|
256
204
|
}
|
|
257
205
|
|
|
258
|
-
@return $
|
|
206
|
+
@return join(join(_quick-sort($less), $equal), _quick-sort($large));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@return $list;
|
|
259
210
|
}
|
|
260
211
|
|
|
261
212
|
/// Sort a map by values (works with numbers only)
|
|
@@ -263,24 +214,29 @@ $mq-media-type: all !default;
|
|
|
263
214
|
/// @access private
|
|
264
215
|
/// @param {Map} $map - Map to sort
|
|
265
216
|
/// @returns {Map} Map sorted by value
|
|
266
|
-
@function
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
217
|
+
@function _map-sort-by-value($map) {
|
|
218
|
+
$map-sorted: ();
|
|
219
|
+
$map-keys: map.keys($map);
|
|
220
|
+
$map-values: map.values($map);
|
|
221
|
+
$map-values-sorted: _quick-sort($map-values);
|
|
271
222
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
223
|
+
// Reorder key/value pairs based on key values
|
|
224
|
+
@each $value in $map-values-sorted {
|
|
225
|
+
$index: index($map-values, $value);
|
|
226
|
+
$key: list.nth($map-keys, $index);
|
|
227
|
+
$map-sorted: map.merge(
|
|
228
|
+
$map-sorted,
|
|
229
|
+
(
|
|
230
|
+
$key: $value,
|
|
231
|
+
)
|
|
232
|
+
);
|
|
277
233
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
234
|
+
// Unset the value in $map-values to prevent the loop
|
|
235
|
+
// from finding the same index twice
|
|
236
|
+
$map-values: list.set-nth($map-values, $index, 0);
|
|
237
|
+
}
|
|
282
238
|
|
|
283
|
-
|
|
239
|
+
@return $map-sorted;
|
|
284
240
|
}
|
|
285
241
|
|
|
286
242
|
/// Add a breakpoint
|
|
@@ -288,56 +244,61 @@ $mq-media-type: all !default;
|
|
|
288
244
|
/// @param {String} $name - Name of the breakpoint
|
|
289
245
|
/// @param {Number} $width - Width of the breakpoint
|
|
290
246
|
///
|
|
291
|
-
/// @requires {Variable} $
|
|
247
|
+
/// @requires {Variable} $breakpoints
|
|
292
248
|
///
|
|
293
249
|
/// @example scss
|
|
294
|
-
/// @include
|
|
250
|
+
/// @include add-breakpoint(tvscreen, 1920px);
|
|
295
251
|
/// @include mq(tvscreen) {}
|
|
296
|
-
@mixin
|
|
297
|
-
|
|
298
|
-
$
|
|
299
|
-
|
|
252
|
+
@mixin add-breakpoint($name, $width) {
|
|
253
|
+
$new-breakpoint: (
|
|
254
|
+
$name: $width,
|
|
255
|
+
);
|
|
256
|
+
$breakpoints: map.merge($breakpoints, $new-breakpoint) !global;
|
|
257
|
+
$breakpoints: _map-sort-by-value($breakpoints) !global;
|
|
300
258
|
}
|
|
301
259
|
|
|
302
260
|
/// Show the active breakpoint in the top right corner of the viewport
|
|
303
261
|
/// @link https://github.com/sass-mq/sass-mq#seeing-the-currently-active-breakpoint
|
|
304
262
|
///
|
|
305
|
-
/// @param {List} $show-breakpoints
|
|
306
|
-
/// @param {Map} $breakpoints
|
|
263
|
+
/// @param {List} $show-breakpoints [$show-breakpoints] - List of breakpoints to show in the top right corner
|
|
264
|
+
/// @param {Map} $breakpoints [$breakpoints] - Breakpoint names and sizes
|
|
307
265
|
///
|
|
308
|
-
/// @requires {Variable} $
|
|
309
|
-
/// @requires {Variable} $
|
|
266
|
+
/// @requires {Variable} $breakpoints
|
|
267
|
+
/// @requires {Variable} $show-breakpoints
|
|
310
268
|
///
|
|
311
269
|
/// @example scss
|
|
312
270
|
/// // Show breakpoints using global settings
|
|
313
|
-
/// @include
|
|
271
|
+
/// @include show-breakpoints;
|
|
314
272
|
///
|
|
315
273
|
/// // Show breakpoints using custom settings
|
|
316
|
-
/// @include
|
|
317
|
-
@mixin
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
274
|
+
/// @include show-breakpoints((L, XL), (S: 300px, L: 800px, XL: 1200px));
|
|
275
|
+
@mixin show-breakpoints(
|
|
276
|
+
$show-breakpoints: $show-breakpoints,
|
|
277
|
+
$breakpoints: $breakpoints
|
|
278
|
+
) {
|
|
279
|
+
body:before {
|
|
280
|
+
background-color: #fcf8e3;
|
|
281
|
+
border-bottom: 1px solid #fbeed5;
|
|
282
|
+
border-left: 1px solid #fbeed5;
|
|
283
|
+
color: #c09853;
|
|
284
|
+
font: small-caption;
|
|
285
|
+
padding: 3px 6px;
|
|
286
|
+
pointer-events: none;
|
|
287
|
+
position: fixed;
|
|
288
|
+
right: 0;
|
|
289
|
+
top: 0;
|
|
290
|
+
z-index: 100;
|
|
330
291
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}
|
|
292
|
+
// Loop through the breakpoints that should be shown
|
|
293
|
+
@each $show-breakpoint in $show-breakpoints {
|
|
294
|
+
$width: get-breakpoint-width($show-breakpoint, $breakpoints);
|
|
295
|
+
@include mq($show-breakpoint, $breakpoints: $breakpoints) {
|
|
296
|
+
content: '#{$show-breakpoint} ≥ #{$width} (#{px2em($width)})';
|
|
297
|
+
}
|
|
338
298
|
}
|
|
299
|
+
}
|
|
339
300
|
}
|
|
340
301
|
|
|
341
|
-
@if length($
|
|
342
|
-
|
|
302
|
+
@if list.length($show-breakpoints) > 0 {
|
|
303
|
+
@include show-breakpoints;
|
|
343
304
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sass-mq",
|
|
3
3
|
"description": "mq() is a Sass mixin that helps manipulating media queries in an elegant way.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"responsive",
|
|
7
7
|
"sass",
|
|
@@ -9,28 +9,29 @@
|
|
|
9
9
|
"mediaquery",
|
|
10
10
|
"query",
|
|
11
11
|
"queries",
|
|
12
|
-
"media"
|
|
13
|
-
"eyeglass-module"
|
|
12
|
+
"media"
|
|
14
13
|
],
|
|
15
14
|
"ignore": [
|
|
16
15
|
"test",
|
|
17
16
|
"sassdoc",
|
|
18
17
|
"**/.*",
|
|
19
|
-
"sache.json",
|
|
20
18
|
"bower.json",
|
|
21
19
|
"sassdoc.sh",
|
|
22
20
|
"scripts"
|
|
23
21
|
],
|
|
24
22
|
"files": [
|
|
25
23
|
"_mq.scss",
|
|
24
|
+
"_mq.import.scss",
|
|
25
|
+
"CHANGELOG.md",
|
|
26
26
|
"LICENSE.md",
|
|
27
27
|
"README.md",
|
|
28
28
|
"sass/index.scss"
|
|
29
29
|
],
|
|
30
30
|
"main": "_mq.scss",
|
|
31
31
|
"scripts": {
|
|
32
|
-
"test": "
|
|
33
|
-
"sassdoc": "./scripts/sassdoc.sh"
|
|
32
|
+
"test": "jest",
|
|
33
|
+
"sassdoc": "./scripts/sassdoc.sh",
|
|
34
|
+
"build:examples": "sass ./examples:./examples --no-source-map"
|
|
34
35
|
},
|
|
35
36
|
"contributors": [
|
|
36
37
|
{
|
|
@@ -48,15 +49,11 @@
|
|
|
48
49
|
},
|
|
49
50
|
"license": "MIT",
|
|
50
51
|
"homepage": "https://sass-mq.github.io/sass-mq/",
|
|
51
|
-
"eyeglass": {
|
|
52
|
-
"needs": ">= 0.8.2",
|
|
53
|
-
"sassDir": "./_mq.scss",
|
|
54
|
-
"exports": false
|
|
55
|
-
},
|
|
56
52
|
"devDependencies": {
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
53
|
+
"glob": "^7.1.7",
|
|
54
|
+
"jest": "^27.0.4",
|
|
55
|
+
"sass": "^1.35.1",
|
|
56
|
+
"sass-true": "^6.0.1",
|
|
57
|
+
"sassdoc": "^2.7.3"
|
|
61
58
|
}
|
|
62
59
|
}
|