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

rucksack-css

v1.0.2

Published

A little bag of CSS superpowers

Downloads

25,974

Readme

A little bag of CSS superpowers, built on PostCSS.

Rucksack makes CSS development less painful, with the features and shortcuts it should have come with out of the box.

Read the full docs at simplaio.github.io

Contents

Install

Rucksack is available on NPM under rucksack-css, install it with Yarn or NPM

$ yarn add rucksack-css --dev
$ npm i rucksack-css --save-dev

Usage

Rucksack can be used as a PostCSS plugin, direclty on the command line, and has helpers available for most build tools.

Gulp

Use gulp-rucksack

const gulp = require('gulp');
const rucksack = require('gulp-rucksack');

gulp.task('rucksack', () => {
  return gulp.src('src/style.css')
    .pipe(rucksack())
    .pipe(gulp.dest('style.css'));
});

Grunt

Use grunt-rucksack

require('load-grunt-tasks')(grunt);

grunt.initConfig({
	rucksack: {
		compile: {
			files: {
				'style.css': 'src/style.css'
			}
		}
	}
});

grunt.registerTask('default', ['rucksack']);

Broccoli

Use broccoli-rucksack

const rucksack = require('broccoli-rucksack');

tree = rucksack(tree, [options]);

CLI

Process CSS directly on the command line

$ rucksack src/style.css style.css [options]

PostCSS

Rucksack is built on PostCSS, and can be used as a PostCSS plugin

const postcss = require('postcss');
const rucksack = require('rucksack-css');

postcss([ rucksack() ])
  .process(css, { from: 'src/style.css', to: 'style.css' })
  .then(result => {
      fs.writeFileSync('style.css', result.css);
      if ( result.map ) fs.writeFileSync('style.css.map', result.map);
  });

See the PostCSS Docs for examples for your environment.

Stylus

Rucksack can be used as a Stylus plugin with PostStylus

stylus(css).use(poststylus('rucksack-css'))

See the PostStylus Docs for more examples for your environment.

Features

Responsive typography

Automagical fluid typography with new responsive arguments to font-size, line-height, and letter-spacing properties

.foo {
  font-size: responsive;
}

Responsive Type Demo

Shorthand positioning syntax

Use the shorthand syntax from margin and padding on position properties

.foo {
  position: absolute 0 20px;
}

Native clearfix

Generate bulletproof clearfixes with a new argument on the clear property

.foo {
  clear: fix;
}

Automatic font src generation

Automatically generate src sets for @font-face based on the path to your font files

@font-face {
  font-family: 'My Font';
  font-path: '/path/to/font/file';
}

Extra input pseudo-elements

Standardize the unweidly <input type="range"> element across browsers with new ::track and ::thumb pseudo elements

input[type="range"]::track {
  height: 2px;
}

Hex shortcuts for RGBA

Generate RGBA colors from a hex color + alpha value

.foo {
  color: rgba(#fff, 0.8);
}

More easing functions

Use a whole library of modern easing functions in transitions and animations

.foo {
  transition: all 250ms ease-out-cubic;
}

Quantity pseudo-selectors

Create truly responsive designs with powerful content quantity selectors

li:at-least(4) {
  color: blue;
}

li:between(4,6) {
  color: red;
}

CSS property aliases

@alias {
  fs: font-size;
  bg: background;
}

.foo {
  fs: 16px;
  bg: #fff;
}

Addons

Autoprefixer

Automatically apply vendor prefixes to relevant properties based on data from CanIUse, via autoprefixer.

Legacy Fallbacks

Automatically generate CSS fallbacks for legacy browsers, via laggard.

Options

All features in Rucksack can be toggled by passing options on initialization. By default core features are set to true, and optional addons are set to false

Option | Type | Default | Description
------------------- | ------- | ------- | ----------- responsiveType | Boolean | true | Whether to enable responsive typography
shorthandPosition | Boolean | true | Whether to enable shorthand position properties
quantityQueries | Boolean | true | Whether to enable quantity query psuedo selectors
alias | Boolean | true | Whether to enable to enable property aliases
inputPseudo | Boolean | true | Whether to enable whether to enable extra input pseudo elements
clearFix | Boolean | true | Whether to enable native clear fix
fontPath | Boolean | true | Whether to enable font src set generation
hexRGBA | Boolean | true | Whether to enable hex RGBA shortcuts
easings | Boolean | true | Whether to enable extra easing functions
fallbacks | Boolean | false | Whether to enable CSS fallbacks addon
autoprefixer | Boolean | false | Whether to enable autoprefixer addon
reporter | Boolean | false | Whether to enable error reporting from plugins used inside Rucksack


MIT © Sean King