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

underscores-css

v0.2.5

Published

A Sass based pattern library

Downloads

31

Readme

Pattern Library

What is it?

This library serves as a collection of patterns (components, elements etc.) for how I build a website. It's not a framework, it's a set of ideas and patterns that I find myself using often, abstracted into re-useable pieces of HTML and CSS.

Who's it for?

Me. I built it so I could take away some of the repetition that comes with starting a new project. That said, if you want to use it, you're more than welcome. I'll be publishing the Sass to NPM and Github.

Install it

npm install underscores-css --save

Use it

/* Import The Library */
@use "node_modules/underscores-css/src/lib" with (

    // See node_modules/underscores-css/src/_tokens.scss
    // for all the defaults tokens. Extend them with your
    // project tokens here
    $projectTokens: (
        'color': (
            'pink': deeppink // Best color
        ),
        'font': (
            'base': 'Comic Sans MS' // Best font
        )
    )
);

/* Import Components you need */
@use 'node_modules/underscores-css/src/components/alert';
@use 'node_modules/underscores-css/src/components/button';

/* Your project CSS */
@use 'main';

/* Include Utilities last to avoid specicifity issues */
@use 'node_modules/underscores-css/src/utilities';

Mixins

This library comes with some mixins to take care of some common tasks, like generating custom properties from tokens or creating responsive utility classes. To use the available mixins, Sass provides the @use directive:

@use 'node_modules/underscores-css/src/mixins/media-query';

// MQ (Media Query) mixin can take a second argument
// Defaults to 'min-width' but any valid CSS is accepted.
// You can also use breakpoint keywords: sm, md, lg and xl.
@include mq(40em) {
    .my-thing {
        color: var(--color-pink);
    }
}

Available Mixins

  • custom-prop($propKey, $key, $value): Generates a single custom property
  • custom-props-from-map($propKey, $map): Generates custom properties based on map values
  • mq($size, $query: "min-width") Generates a media query
  • responsive-util($className, $selector, $value): Generates a responsive utility class
  • responsive-util-from-map($className, $selector, $map): Generates responsive utility classes based on map values
  • util($className, $selector, $value): Generates a single utility class (not responsive)
  • util-from-map($className, $selector, $map): Generates utility classes based on map values

I will write up proper documentation for these soon. For now if you're curious, I have commented the code (decently well, I think) so it should explain what's happening.

Functions

The functions available are mostly used internally, but you can use them in your project should you need to.

Available Functions

  • auto-color($color): Returns black/white based on the lightness of the passed in colour
  • non-destructive-map-merge($parent-map, $child-map): Merges 2 maps resursively
  • rem($multiple): Returns a REM value based on 4px grid scale, e.g. rem(1) === .25rem

Same goes here with regards to documentation, I will get it written up when I can.

Sass Load Path

It's going to get annoying to type "node_modules/underscores-css/src" everytime you want to use something from the library, so I'd recommend adding it to your load path, so you can just reference the files directly!

With the load path configured, you can do this:

@use 'lib'; // instead of node_modules/underscores-css/lib