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

sassy-mixins

v1.0.3

Published

Sass mixins to help you respect user preferences—because you should. Never write a _mixins.scss again.

Downloads

1

Readme

Sassy Mixins banner, pink background, woman tipping hand emoji swearing

Sassy Mixins

Never write a _mixins.scss file again.

You've finally realized you should respect the preferences of users on the web. (You were probably told to, though.) Either way, it's about time.

This criminally lightweight package grants you the power to use the latest media query features from the Media Queries Level 5 CSS specification to ensure you build web experiences that respect settings and preferences a user has selected in their browser or their operating system.

Available mixins (9)

Color (4)

  • Forced colors
  • Inverted colors
  • Contrast: more
  • Contrast: less

Data (1)

  • Reduced data

Motion (1)

  • Reduced motion

Theme (2)

  • Dark mode
  • Light mode (non-dark mode)

Transparency (1)

  • Reduced transparency

How to use this package

Assuming you're using Sass already, you have two easy steps:

  1. Install the package as a development dependency.
npm install -D sassy-mixins
  1. Reference sassy-mixins/mixins.scss in your Sass file and use the mixins. (I recommend namespacing your import so you know which place your mixins come from, but it's not required.)
@use '{path/to/your/node_modules}/sassy-mixins/mixins' as sassy;

.dubstep-lighting {
  animation: pulsate 500ms infinite;

  @include sassy.prefers-reduced-motion {
    animation: none;
  }
}

Note: The path to the location of the sassy-mixins/_mixins.scss file may change depending on your project configuration or code bundlers you are using. You should probably use a relative path.

@use vs. @import

  • If you use Dart Sass >= v1.23.0, you can use @use.
  • If you use LibSass or Ruby Sass, you must use @import.

Frequently asked questions

Will this increase my bundle size?

No. Sass partials are not compiled into CSS.

The code contained in _mixins.scss is not directly compiled into CSS.

Will this make me a better developer?

Yes. Not only does respecting user preferences make you a better developer, it makes you a better human being.

Can I use this with LESS?

Sure. You can copy the code inside the @mixin and replace the @content with whatever code you want to apply for that user preference.

Can I use this without Sass?

Sure. You can copy the code inside the @mixin and replace the @content with whatever code you want to apply for that user preference.

Future additions

Whenever the Media Queries specification publishes a new draft, I will update this package.