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

rework-flex-grid

v0.1.0

Published

Rework CSS plugin for generating custom flex grids.

Downloads

12

Readme

Rework Flex Grid

Build Status

Rework CSS plugin for generating custom, lightweight flex grids.

Why?

Every project is different.

You should be able to create a grid on the fly that's catered to your project. If you only want 8 columns you can create a grid with exactly 8 columns rather than being stuck with 12. This helps to avoid unnecessary bloat in your CSS. This grid generator uses flex to dramatically reduce CSS declarations in the grid system.

Mobile-first

Rework Flex Grid creates a grid system that is 100% mobile-first. This ensures that mobile browsers aren't forced to parse media queries when they're not applicable. Less parsing means faster rendering which means faster load-to-content times which means happier users. Yay.

Customizable

You come up with your own naming scheme for classes. You set the breakpoints. You decide if you want column offsets. It's all in the configuration.

Low Specificity

All grid classes have a specificity value of 10. They consist of one class, and exactly one class, resulting in CSS similar to:

.gridClass {
  /* ... */
}

.gridClass-rowClass {
  /* ... */
}

.gridClass-rowClass-columnClass-1-12 {
  /* ... */
}

.gridClass-rowClass-columnClass-offset-1 {
  /* ... */
}

@media screen and (min-width: 32rem) {
  .gridClass-rowClass-columnClass--sm {
    /* ... */
  }
}

This ensures that the grid won't stomp on your styles, and makes it easy for you to override defaults.

Installation

npm install --save rework-flex-grid

Usage

var fs       = require('fs'),
    rework   = require('rework'),
    flexGrid = require('rework-flex-grid');

var flexGridOptions = {
  numColumns: 12,
  classNames: {
    grid: 'g',
    row: 'r',
    col: 'c'
  },
  mediaQueries: {
    sm: '32rem',
    md: '48rem',
    lg: '64rem'
  },
  offsets: true
};

var css = fs.readFileSync('css/my-file.css', 'utf8').toString();
var out = rework(css).use(flexGrid(flexGridOptions)).toString();

Note: This plugin produces CSS that should be prefixed.

Options

  • numColumns, Number for the number of columns. Defaults to 12.
  • classNames, Object with grid, row, and col. Defaults to g, r, and c respectively.
  • mediaQueries, Object with sm, md, and lg. Defaults to 32rem, 48rem, and 64rem respectively.
  • offsets, Boolean to determine whether to include offsets or not. Defaults to false.

TODO:

  • [X] Create a mini app to allow people to generate grids in their browser.
  • [X] Offset configuration.
  • [X] Media queries.
  • [X] Media query configuration.
  • [ ] Make default grid classes responsive 12 > 6 > 1

Acknowledgements

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted with <3 by John Otander (@4lpine).