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

css-patterns

v0.2.0

Published

A CSS pattern library for Sass

Downloads

295

Readme

A CSS pattern library for Sass

At Made by Many we love Sass and we love Bourbon. We use these technologies in almost every project we build and they give us a great base onto which we can build our CSS.

In addition we've been compiling a library of common CSS patterns for some time now. We noticed that we were reusing different patterns to produce effects and layouts in all our projects and decided to break them out into reusable chunks.

The way we write CSS tends to follow BEM syntax and closely resembles some OOCSS practices. However, we tend to prefer using the Sass @include method to add patterns to CSS rules, rather than littering our elements with multiple styles.

For instance, we tend to favour this approach with mixins:

.my-list-element {
  @include inline-list;
  background: blue;
}
<ul class="my-list-element">
</ul>

Rather than this one with additional classes:

.my-list-element {
  background: blue;
}
<ul class="my-list-element inline-list">
</ul>

Most of these patterns were developed by much smarter people than us and this library has been compiled with patterns from all over the internet. We will try and credit those smart people where we can, but if we've overlooked anyone please let us know or submit a PR to rectify our mistake.

How it works

.list {
  @include unstyled-list;
}

These patterns are a collection on Sass mixins. Much like Bourbon, nothing will be added to your compiled CSS that you did not explicitly @include.

Installing with Bower

$ bower install css-patterns --save

In your root Sass file:

@include "bower_components/css-patterns/stylesheets/patterns"

Replace bower_components/ here with the name of your bower component directory if necessary.

Installing with NPM

$ npm install css-patterns --save

The following was adapted directly from the excellent node-bourbon project.

To use css-patterns with tools like Gulp, Grunt, or directly with node-sass, provide the path to css-patterns in your Sass config.

The includePaths property returns an array of pattern paths to use in your config.

var patterns = require('css-patterns');
patterns.includePaths // Array of pattern paths

Now pass that array as a property to your Sass compilation function

var generatedCss = sass.renderSync({
  file: __dirname + '/my_sass_file.scss',
  includePaths: patterns.includePaths
});

In your root stylesheet include the following:

@import "patterns";

Contributing

  1. Add a new pattern with documentation
  2. Update tests to reflect your change and npm test
  3. Test docs locally with npm run docs
  4. Commit and push
  5. npm run publish-docs
  6. View at http://madebymany.github.io/css-patterns/

Contributors

Changelog

0.2.0

  • Convert all patterns to mixins to promote usage with @include

0.1.0

  • Move to @HugoGiraudel's mixin technique. Backwards compatible.