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 🙏

© 2026 – Pkg Stats / Ryan Hefner

include-container

v1.0.3

Published

Simple, elegant and maintainable container queries in Sass. A respectful adaptation of include-media by Eduardo Boucas and Kitty Giraudel.

Readme

include-container

GitHub release License: MIT GitHub Pages npm version Sass

A tiny Sass helper that ports the beloved include-media API to Container Queries.

  • Same shorthand syntax: '>=md', '<lg', 'height >= 40ch'
  • No media-query fallback (by design) — no global layout surprises
  • Optional @supports guard for container-type (enabled by default)
  • Works with named containers (container-name) or unnamed ones
  • Ships with a sensible default breakpoints map and unit intervals (including ch)

Author: @PaulLVG
License: MIT


Credits & Acknowledgements

This project is a respectful fork and adaptation of the wonderful include-media library originally created by:

All credits go to them for their elegant Sass design and documentation style.
This project merely extends their ideas to CSS Container Queries.

Maintained by @PaulLVG


Installation

npm i -D include-container
# or
pnpm add -D include-container

Import it in your Sass folder:

// Override defaults BEFORE importing (optional)
$ic-breakpoints: (
  'xxs': 320px,
  'xs':  480px,
  'sm':  640px,
  'md':  768px,
  'lg':  1024px,
  'xl':  1280px,
  'xxl': 1536px
);

// Optionally disable @supports guard (not recommended)
$ic-guard-supports: true;

// Now import the library
@use "include-container";

If you vend this file directly (not via npm), just @use "include-container"; with the file in your load path.


Getting started

Examples

// Inline-size by default
@include container('>=md') {
  .card { display: grid; gap: 1rem; }
}

// Height-based container query
@include container('height >= 40ch') {
  .teaser { display: block; }
}

// Named container
@include container('>=lg', $name: 'layout') {
  .sidebar { position: sticky; top: 1rem; }
}

// Combine conditions (min AND max)
@include container('>=sm', '<=lg') {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

// Custom tweakpoint in scope:
@include container-context(($tall: 70ch)) {
  @include container('height>=tall') {
    .hero { align-items: center; }
  }
}

Backwards-compatible alias

Just in case your project already includes a mixin called "container", this syntax also works:

@include include-container('>sm') { /* ... */ }

Browser support

Relies on CSS Container Queries, supported by all modern browsers:

  • Chrome ≥ 105
  • Edge ≥ 105
  • Firefox ≥ 109
  • Safari ≥ 16.4

Use the @supports (container-type: inline-size) guard to prevent errors on older engines.


Why another library?

include-container brings the same developer experience as include-media — but for Container Queries. No reinvented syntax, no JavaScript runtime, just pure Sass sugar syntax for modern responsive components.


Why no media-query fallback?

Container Queries are contextual. Falling back to viewport-based media queries can break layouts when a component is designed to react to its container (e.g., a small card in a wide desktop page).
This library does not emit any media fallback by design. It optionally wraps output with:

@supports (container-type: inline-size) { ... }

So unsupported browsers just don’t apply those rules (safer default).


API

@include container($conditions..., $name: null, $type: null, $supports: null)

  • $conditions...: one or more shorthand expressions (strings)
    • '>=md', '<lg'
    • 'height >= 40ch', 'block-size < 60ch'
  • $name: optional container name (must match container-name in your CSS)
  • $type: if set to 'size', the @supports guard uses (container-type: size).
    • When omitted, inline-size is assumed.
  • $supports: whether to wrap output in a @supports rule. Defaults to $ic-guard-supports (true).

The mixin supports multiple conditions by nesting @container rules (equivalent to logical AND).


Configuration

Breakpoints

Default map (override before @use):

$ic-breakpoints: (
  'xxs': 320px,
  'xs':  480px,
  'sm':  640px,
  'md':  768px,
  'lg':  1024px,
  'xl':  1280px,
  'xxl': 1536px
);

You can refer to named breakpoints in conditions, e.g. '>=md', '<xl'.

Unit intervals

For exclusive ranges (> / <), include-container adjusts the numeric value with a small unit interval (like include-media). Default:

$ic-unit-intervals: (
  'px': 1,
  'em': 0.01,
  'rem': 0.1, // common when :root font-size is 62.5%
  'ch': 0.1,  // convenient for typographic widths
  '':  0
);

So '> 40ch' becomes (min-width: 40.1ch) and '< 60ch' becomes (max-width: 59.9ch).

Supports guard

Enabled by default for safety:

$ic-guard-supports: true;
  • If $type: 'size', guard uses (container-type: size).
  • Otherwise it uses (container-type: inline-size).

Set $ic-guard-supports: false only if you’re certain about your target browsers.


Using ch units (typographic containers)

ch is roughly the width of the “0” glyph in the current font. It’s great for readable text widths. Common guidelines:

  • Long-form text line length: 55–75ch sweet spot
  • Narrow columns / sidebars: 35–50ch
  • Hero text blocks: 60–75ch

Examples:

// Make a card layout once the container is at least a comfortable text width
@include container('>= 60ch') {
  .article-card { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
}

// Collapse to a single column below 45ch
@include container('< 45ch') {
  .article-card { grid-template-columns: 1fr; }
}

Remember: the parent must establish a container context, e.g.:

.content-area {
  container-type: inline-size;          // or: size
  container-name: layout;
}

Links

  • Author: @PaulLVG
  • Repo: https://github.com/PaulLVG/include-container
  • Docs (GitHub Pages): https://paullvg.github.io/include-container/
  • npm: https://www.npmjs.com/package/include-container

License

MIT © @PaulLVG