npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ryniaubenpm/iure-esse-unde

v1.0.0

Published

<div align="center"> <img width="500" height="500" src="https://avatars3.githubusercontent.com/u/9341289?v=3&s=500" alt="Awesome"> </div>

Downloads

6

Maintainers

mi762136mi762136

Keywords

pathduplexdescriptionES2020minimalaccessibilityloggerJSONRxestreeshrinkwrapmixinsasserteslint-pluginwatcherkeycolumnsprogresstimeinterruptstypejslook-upcryptexpressionES6CSSjson-schema-validatorjestefficientviewfunctionIteratorlaunchWeakMapcss nestingargumentsmimecommanderenvironmentes-shim APIAsyncIteratorartmiddlewarewatchingsettertraversematchAlldependenciesbootstrap lessboundcallbackRegExp#flagsspring_.extendttywarningautoprefixerESstreamstylesheetless compilerhigher-orderopenerwebsitecollectionequalityoptimizerarrayobj__proto__Object.assignES2019ajvbusystringifysortnegativeHyBientrieserror-handlingreduceYAMLfetchvestbrowsercolorsdebuggerairbnbcharacterrequireenv256javascriptecmascript$.extendutil.inspectcss variableguidinternal slotposeStyleSheetstyleguideencryptionoperating-systemdom-testing-libraryparentmomentmergeflatMapsequenceECMAScript 2021bundler@@toStringTageventslimittestingpackagessearchless.jstaskfileloggingargumentmoduleanimationsymbolsdeepECMAScript 2016mochautilitiesURLArrayBufferObject.getPrototypeOfjsxJSON-SchemaserializewhatwgjasminelistenershttpbrowserslistratelimitrateeveryInt16ArrayregularstreamsfindLasthandlers0babelloadingeast-asian-widthRFC-6455validatortypedarraysiterateArrayBuffer#slicedefinePropertymimetypestakedeep-copyES3fast-deep-clonedotenvES2018fsStreamramdaquoteexit-codecommandutilmime-dblockfilenumberpolyfilltypeofeventEmitterdragconcurrencyshareddefineequalexecutableRegExp.prototype.flagsclientconsoleform-validationString.prototype.trimsetImmediateextrastdlibkarmalessletregextc39RxJSrequesttypescriptlogcoercibleshellcallboundauthasciiObject.entriesreact-testing-libraryECMAScript 2023Array.prototype.flattenfullwidthdir.envsuperstructuser-streamsdefaultBigInt64ArrayvariablesReactiveXenderECMAScript 7flattencallbindvalueperformantgetPrototypeOfparentsUnderscoretranspilerECMAScript 2018es8optiontostringtagweakmapiteratorgetoptmatchesreact posetypesafenativecontainstoobjectuuidextendlinuxgesturesES8trimopenchannelstringprototypeESnextwordbreakl10nargvTypeScriptcomputed-typeswidthwalkingless mixinstypedgradients css3multi-packagerapidfunctionalECMAScript 2022watchFilecsspureschemetoSortedlibphonenumberclassesES2023make dirassignmakethreeshamobjectObjectcoreformskeysframeworkSymboldeepcopyreadqueryauthenticationprunekoreanwindowsschemaObject.keysharmonyMapdatabluebirdes2018installerpersistentES2016private dataparseSymbol.toStringTagdeepclonevalidatetyped arrayes2015querystringsyntaxtapmetadatapackage managerObservablescolorsameValueZeropromisesES7i18nintrinsicframerxdg-openpreprocessorcensorconsta11yreduxECMAScript 3chaipluginapirm -frfilterimporttslibterminalwhichpropmodulesinferencesymboldayjstypanionslicesuperagentspinnersclipostcsstypedarrayhashvalidationsetcore-jsmatchhasdeterministicstyleslinewrapES2015dataViewfseventsECMAScript 2015diffwriteismacosstarterstartcss-in-jsclass-validatorlintfixed-widthWebSocketspicomatchsideFloat64ArrayhookformmkdirpshimdeleteArray.prototype.includessigtermflateslintcolourstatusjsonschemaoncefinduputilsmaptrimStartfast-clonelengthtapefolderstatelessstructuredCloneuninstallFunction.prototype.namebreakqueuedescriptorfigletjQueryrecursivecompilercircularreadablestreamsiginttestgdprhooksgroupMicrosoftcmdECMAScript 2017rmdircommand-linemobilegetterArray.prototype.containsoptimistansieditortranspilecorscss lesswalkpromiseasturlschinesejapanesesomepackageWebSocketdataviewwaitpnpm9arktypenpmnested cssprefixrmfindLastIndexwgetslotcurriedprivatefast-deep-copymovestyleformclassnameFloat32ArrayexeInt8Arrayexecpositiveconfigurableredux-toolkitchildbootstrap cssmonorepojsdiffcollection.es6generics3dtrimRightlrucode pointsphoneajaxreactpatchlesscssimmerbundlingjson-schema-validationwordwrapremoveparserArray.prototype.filterrfc4122react-hook-formregular expressionsqsarraybufferurlelectronUint32ArraysafecodesiterationidlesetPrototypeOfomitUint8Arraypreserve-symlinksreal-timefindredactutilityisConcatSpreadabledomStreamsclassnamesruntimeforEachtddserializationpipecomparethroatArrayBuffer.prototype.sliceupgraphqlworkerclonepasswordcharactersgradients cssdirectoryregular expressionescapeUint8ClampedArrayreadabledeep-cloneformatInt32ArrayirqiedateECMAScript 6apolloresolveformatting

Readme

Media Queries with superpowers Build Status

mq() is a Sass mixin that helps you compose media queries in an elegant way.

Here is a very basic example:

@use 'mq' as * with (
  $breakpoints: (
    mobile: 320px,
    tablet: 740px,
    desktop: 980px,
    wide: 1300px,
  )
);

.foo {
  @include mq($from: mobile, $until: tablet) {
    background: red;
  }
  @include mq($from: tablet) {
    background: green;
  }
}

Compiles to:

@media (min-width: 20em) and (max-width: 46.24em) {
  .foo {
    background: red;
  }
}
@media (min-width: 46.25em) {
  .foo {
    background: green;
  }
}

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.

How to use it

Immediately play with it on SassMeister: @use 'mq';.

OR:

  1. Install:

    • with Bower: bower install sass-mq --save
    • with npm: npm install sass-mq --save
    • with yarn: yarn add sass-mq

    OR Download _mq.scss into your Sass project.

  2. Import the partial in your Sass files and override default settings with your own preferences:

// Name your breakpoints in a way that creates a ubiquitous language
// across team members. It will improve communication between
// stakeholders, designers, developers, and testers.
$breakpoints: (
  mobile: 320px,
  tablet: 740px,
  desktop: 980px,
  wide: 1300px,
  // Tweakpoints
  desktopAd: 810px,
  mobileLandscape: 480px,
);

// If you want to display the currently active breakpoint in the top
// right corner of your site during development, add the breakpoints
// to this list, ordered by width. For examples: (mobile, tablet, desktop).
$show-breakpoints: (mobile, mobileLandscape, tablet, desktop, wide);

@use 'path/to/mq' with (
  $breakpoints: $breakpoints,
  $show-breakpoints: $show-breakpoints
);

Notes about @use Vs @import

When using the @use directive, you have to change your mindset when working with vars, functions or mixins and how they are now seen by Sass.

Previously, with the @import statement any var, function, or mixin were exposed in the global scope. That means that you could define a var like $mq-media-type: all in your main sass file and use it anywhere as long as the main file had been loaded previously.

This was possible because vars, functions, and mixins were set in the global scope.

One drawback of this behaviour was that we needed to ensure not to pollute the global scope with common names or names that may be already taken by any other library.

To solve this matter, we mostly used a prefix in vars, functions, or mixins in order to avoid collapsing names.

Now with the new @use directive, no var, function, or mixin is placed in global scope, and they are all scoped within the file.

That means that we explicitly need to include the partial file in each file that may use its vars, functions or mixins (similar to ES6 import modules).

So, previously we could have a typical setup like this:

// main.scss
@import 'mq';
@import 'typography';
@import 'layout';
@include mq($from:tablet) {
  ...
}

...

// typography.scss
@include mq($from:tablet) {
  ...
}

Now, you will need to explicitly import the _mq.scss file in each file that needs to use any var, function or mixin from it:

// main.scss
@use 'mq';
@use 'typography';
@use 'layout';
@include mq.mq($from:tablet) {
  ...
}
...

// typography.scss
@use 'mq';
@include mq.mq($from:tablet) {
  ...
}

Other important things about @use:

  • The file is only imported once, no matter how many times you @use it in a project.

  • Variables, mixins, and functions (what Sass calls “members”) that start with an underscore (_) or hyphen (-) are considered private, and not imported.

  • Members from the used file are only made available locally, but not passed along to future imports.

  • Similarly, @extends will only apply up the chain; extending selectors in imported files, but not extending files that import this one.

  • All imported members are namespaced by default.

Please see introducing-sass-modules for more info about sass modules.

  1. Play around with mq() (see below)

Responsive mode

mq() takes up to three optional parameters:

  • $from: inclusive min-width boundary
  • $until: exclusive max-width boundary
  • $and: additional custom directives

Note that $until as a keyword is a hard limit i.e. it's breakpoint - 1.

@use 'mq';

.responsive {
  // Apply styling to mobile and upwards
  @include mq.mq($from: mobile) {
    color: red;
  }
  // Apply styling up to devices smaller than tablets (exclude tablets)
  @include mq.mq($until: tablet) {
    color: blue;
  }
  // Same thing, in landscape orientation
  @include mq.mq($until: tablet, $and: '(orientation: landscape)') {
    color: hotpink;
  }
  // Apply styling to tablets up to desktop (exclude desktop)
  @include mq.mq(tablet, desktop) {
    color: green;
  }
}

Verbose and shorthand notations

Sometimes you’ll want to be extra verbose (for example, if you’re developing a library based on top of sass-mq), however for readability in a codebase, the shorthand notation is recommended.

All of these examples output the exact same thing and are here for reference, so you can use the notation that best matches your needs:

@use 'mq';
// Verbose
@include mq.mq(
  $from: false,
  $until: desktop,
  $and: false,
  $media-type: $media-type // defaults to 'all'
) {
  .foo {
  }
}

// Omitting argument names
@include mq.mq(false, desktop, false, $media-type) {
  .foo {
  }
}

// Omitting tailing arguments
@include mq(false, desktop) {
  .foo {
  }
}

// Recommended
@include mq($until: desktop) {
  .foo {
  }
}

See the detailed API documentation

Adding custom breakpoints

@include add-breakpoint(tvscreen, 1920px);

.hide-on-tv {
  @include mq(tvscreen) {
    display: none;
  }
}

Seeing the currently active breakpoint

While developing, it can be nice to always know which breakpoint is active. To achieve this, set the $show-breakpoints variable to be a list of the breakpoints you want to debug, ordered by width. The name of the active breakpoint and its pixel and em values will then be shown in the top right corner of the viewport.

// Adapt the list to include breakpoint names from your project
$show-breakpoints: (phone, phablet, tablet);

@use 'path/to/mq' with (
  $show-breakpoints: $show-breakpoints
);

$show-breakpoints

Changing media type

If you want to specify a media type, for example to output styles for screens only, set $media-type:

SCSS

@use 'mq' with (
  $media-type: screen
);

.screen-only-element {
  @include mq.mq(mobile) {
    width: 300px;
  }
}

CSS output

@media screen and (max-width: 19.99em) {
  .screen-only-element {
    width: 300px;
  }
}

Implementing sass-mq in your project

Please see the examples folder which contains a variety of examples on how to implement "sass-mq"

Backward compatibility with @import

Just in case you need to have backward compatibility and want to use@import instead of @use, you can do so by importing _mq.import.scss instead of _mq.scss.

Please see legacy.scss on examples folder.

Running tests

npm test

Generating the documentation

Sass MQ is documented using SassDoc.

Generate the documentation locally:

sassdoc .

Generate & deploy the documentation to http://sass-mq.github.io/sass-mq/:

npm run sassdoc

Inspired By…

On Mobile-first CSS With Legacy Browser Support

Who uses Sass MQ?

Sass MQ was developed in-house at the Guardian.

These companies and projects use Sass MQ:


Looking for a more advanced sass-mq, with support for height and other niceties?
Give @mcaskill's fork of sass-mq a try.