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

adaptive-scss

v1.2.1

Published

scss mixins for adding adaptivity to webapp in one line of code

Downloads

18

Readme

adaptive-scss

A minimalistic scss library for working with media queries with the ability to specify custom media breakpoints. Great for mobile-first development. This library is just a collection of useful mixins. Assembly and processing (minimization, division into chunks, combining identical media queries) you need to configure yourself depending on the features of your project.

Instalation

npm

npm i adaptive-scss

yarn

yarn add adaptive-scss

Default breakpoints

| breakpoint name | screen width size | | --------------- | ----------------- | | xs | >=0px | | sm | >=576px | | md | >=768px | | lg | >=992px | | xl | >=1200px | | xxl | >=1900px |

Usage

Default usage

This scss:

@import 'adaptive-scss';

body {
  background-color: yellowgreen;

  @include _media-up(md) {
    background-color: green;
  }

  @include _media-up(xl) {
    background-color: red;
  }
}

will be converted to this css:

body {
  background-color: yellowgreen;
}

@media (min-width: 768px) {
  body {
    background-color: green;
  }
}

@media (min-width: 1200px) {
  body {
    background-color: red;
  }
}

Usage with custom breakpoints list

You can set your own list of breakpoints. The easiest way is to create a wrapper mixin.

@import 'adaptive-scss';

$list: (
  mobile: 0,
  tablet: 700px,
  desktop: 1400px,
);

@mixin media-up($name) {
  @include _media-up($name, $list) {
    @content;
  }
}

body {
  background-color: yellowgreen;

  @include media-up(tablet) {
    background-color: green;
  }

  @include media-up(desktop) {
    background-color: red;
  }
}

As a result, we get this:

body {
  background-color: yellowgreen;
}

@media (min-width: 768px) {
  body {
    background-color: green;
  }
}

@media (min-width: 1200px) {
  body {
    background-color: red;
  }
}

set size manually

You can also set size without $breakpoints-list. In normal situations it will not to be use, but if you need this, you can do this.

.elem {
  @include _media-up(200px) {
    background-color: green;
  }
}

Output css:

@media (min-width: 200px) {
  .elem {
    background-color: green;
  }
}

mixins


_media-up

scss

@include _media-up(sm) {
  .elem {
    color: #f00;
  }
}

css

@media (max-width: 576px) {
  .elem {
    color: #f00;
  }
}

_media-down

scss

@include _media-down(sm) {
  .elem {
    color: #f00;
  }
}

css

@media (max-width: 576px) {
  .elem {
    color: #f00;
  }
}

_media-up-portrait

scss

@include _media-up-portrait(sm) {
  .elem {
    color: #f00;
  }
}

css

@media (orientation: portrait) and (min-width: 576px) {
  @content;
}

_media-up-landscape

scss

@include _media-up-landscape(sm) {
  .elem {
    color: #f00;
  }
}

css

@media (orientation: landscape) and (min-width: 576px) {
  @content;
}

_media-down-portrait

scss

@include _media-down-portrait(sm) {
  .elem {
    color: #f00;
  }
}

css

@media (orientation: portrait) and (max-width: 576px) {
  @content;
}

_media-down-landscape

scss

@include _media-down-landscape(sm) {
  .elem {
    color: #f00;
  }
}

css

@media (orientation: landscape) and (max-width: 576px) {
  @content;
}

_media-screen

scss

@include _media-screen {
  .elem {
    color: #f00;
  }
}

css

@media screen {
  .elem {
    color: #f00;
  }
}

_media-print

scss

@include _media-print {
  .elem {
    color: #f00;
  }
}

css

@media print {
  .elem {
    color: #f00;
  }
}

_media-portrait

scss

@include _media-portrait {
  .elem {
    color: #f00;
  }
}

css

@media (orientation: portrait) {
  .elem {
    color: #f00;
  }
}

_media-landscape

scss

@include _media-landscape {
  .elem {
    color: #f00;
  }
}

css

@media (orientation: landscape) {
  .elem {
    color: #f00;
  }
}