
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
simple-include-media
Advanced tools
A simple, all-rounded and easy-to-use media queries library for Sass(Scss)
A simple, all-rounded and easy-to-use media queries library in Sass(Scss).
.example-class {
@include media(">=phone & <tablet") {
// your css
}
}
will become
@media (min-width: 480px) and (max-width: 767px) {
.example-class {
// your css
}
}
Do not use any space right after the operators ">", "<", ">=", "<=" and "=".
It now supports recursive parsing! You can now use the new function mediaAddExpressions to add expressions like "medium": ">phone & <=tablet" to further manager you media queries. You can find an example under folder "example".
***Please be careful when adding expression to avoid any endless loop. eg. "not": "not all and is not allowed.
In cmd, run npm i simple-include-media --save-dev and include _simple-include-media.scss inside dist in your build. The default directory should be "node_modules/simple-include-media/dist".
Download the file dist/_simple-include-media.scss and import it.
Type @import "path/to/simple-include-media"; in you Scss file.
In your config file, add includePaths: ["./path/to/simple-include-media/dist"] in option of sass-loader and type @import "simple-include-media"; in you Scss file.
@include media($yourExpression) {...}
https://willisshek.github.io/Simple-Include-Media/index.html
Every time you @include media($string), it separates the input string according to space. Than it will parse the separated expressions by the following.
"&" and "&&" to represent "and".npm npm">", "<", ">=", "<=" or "=". The format should be $dimension>=$value
$value will be converted into number. If it can find a key in $mediaBreakpoints, the corresponding value will be used.$dimension is empty, "width" will be used. If not, it will return the same string. You can use "w" for "width", "h" for "height" and "a" for "aspect-ratio"."max-" and "min-" are added automatically according to the operator.$dimension and operators."not" will return "not"..example-class {
@include media("! <desktop and landscape") {
// first css
}
@include media("h>360px | a>=1") {
// second css
}
}
will be compiled into
@media not all and (max-width: 1023px) and (orientation: landscape) {
.example-class {
// first css
}
}
@media (min-height: 361px), (min-aspect-ratio: 1) {
.example-class {
// second css
}
}
***No space is allow in the key of variables.
">", "<", ">=", "<=" or "=".">", "<", ">=", "<=" or "=" as key.">", "<", ">=", "<=" or "=" in the key.">=t": ">=tablet". In such case, ">=t" will become ">=tablet" and become "(min-width: 768px)" finally.">" or "<".$mediaBreakpoints: mediaAddBreakpoints(("retina": 1920px)) // be carefull there are double brackets;$mediaBreakpoints: at the beginning;$mediaBreakpoints: map-merge($mediaBreakpoints, ("retina": 1920px));, but more convenience.$mediaExpressions: mediaAddExpressions(("small": "<=phone")) // be carefull there are double brackets;$mediaExpressions: at the beginning;$mediaExpressions: map-merge($mediaExpressions, ("small": "<=phone"));, but more convenience.Remember to add ; to the end of every @import to avoid potential error.
FAQs
A simple, all-rounded and easy-to-use media queries library for Sass(Scss)
We found that simple-include-media demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.