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

include-media-spread

v2.0.0

Published

An include-media plugin for spreading css properties over the breakpoints

Downloads

8

Readme

include-media - Spread plugin

An include-media plugin for spreading css properties over breakpoints

NPM

Build Status Dev Dependencies npm

Requirements

Introduction

This plugin calculates the difference between property values and distributes them through your include-media breakpoints.

Example

@use 'include-media' as *;
@use 'include-media-spread' as *;

$breakpoints: (small: 480px, medium: 768px, large: 1024px);

.heading-1 {
  @include spread(font-size, 1rem, 3rem);
}

Generates


/* Mobile first*/
.heading-1 {
  font-size: 1rem;
}
@media (min-width: 480px) {
  .heading-1 {
    font-size: 1.67rem;
  }
}
@media (min-width: 768px) {
  .heading-1 {
    font-size: 2.33rem;
  }
}
@media (min-width: 1024px) {
  .heading-1 {
    font-size: 3rem;
  }
}

Easing

Spread also allows you to pass a ease argument to accelerate or decelerate through the difference in values

// ease options - linear (default), in-quad, out-quad, in-cubic, out-cubic, in-quart, out-quart, in-quint, out-quint

.heading-1 {
  // value increases on a curve, accelerating
  @include spread(font-size, 1rem, 3rem, 'in-quad');
}

Multi-value

Allows you to pass top/right/bottom/left values and spread will calculate the difference between the single and multi values.

Example

.module-block {
  @include spread(padding, 15px, 20px 30px 10px);
}

Generates

.module-block {
  padding: 15px;
}
@media (min-width: 480px) {
  .module-block {
    padding: 16.67px 20px 13.33px 20px;
  }
}
@media (min-width: 768px) {
  .module-block {
    padding: 18.33px 25px 11.67px 25px;
  }
}
@media (min-width: 1024px) {
  .module-block {
    padding: 20px 30px 10px 30px;
  }
}

Custom breakpoints

You can either override globally the breakpoints Include Media Spread will use by default by setting $ims-breakpoints. By default it uses the default include-media breakpoints.

Example

$my-breakpoints: (small: 340px, large: 1000px);
$ims-breakpoints: $my-breakpoints;

@use 'include-media-spread' as *;

Or you to pass custom-breakpoint per mixin.

Example

$custom-breakpoints: (small: 15em, large: 40em);

.module-block {
  @include spread(padding, 10px, 30px, $breakpoints: $custom-breakpoints);
}

Generates

.module-block {
  padding: 10px;
}
@media (min-width: 15em) {
  .module-block {
    padding: 20px;
  }
}
@media (min-width: 40em) {
  .module-block {
    padding: 30px;
  }
}

Install

  • Npm - npm install include-media-spread
  • Yarn - yarn add include-media-spread
  • Manually - download dist/_spread.scss and include in your sass project

Author

Jack McNicol

Credit to Doug Avery who a lot of code was borrowed from.