Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rucksack-css

simplaio19kMIT1.0.2

A little bag of CSS superpowers

rucksack, postcss, css, framework, boilerplate

readme

rucksack logo

NPM version Downloads Build satus

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

changelog

Change Log

v1.0.0 (2017-08-01)

Full Changelog

Closed issues:

  • Impossible to use rems if set responsive on html? #53
  • Position shorthand doesn't work more #48

v0.9.1 (2016-11-25)

Full Changelog

Closed issues:

  • Document reporter as addon in website #46

v0.9.0 (2016-11-25)

Full Changelog

Fixed bugs:

  • Problem when declaring text in content property if same as alias #41

Closed issues:

  • I get undefined [undefined] - how I can debug it #44
  • postcss-position-alt #43
  • Autoprefixer options #40
  • Responsive typography + line height? #31

Merged pull requests:

  • Make reporter configurable, off by default #45 (jescalan)

v0.8.6 (2016-04-17)

Full Changelog

Implemented enhancements:

  • Show output code on home page #21

Fixed bugs:

  • @font-face #26

Closed issues:

  • Font shorthand property with calc() statements don't work in Firefox #37
  • Extension to quantity queries. Last 4 of 7 items. #35
  • Invalid input file path error, when using Rucksack on Windows platform #33
  • Autoprefixer with options? #29
  • Font-size responsive no longer working as of ~Chrome 47.0.2526.73 #27
  • Responsive font-size breaks in Chrome Canary #24

Merged pull requests:

  • Fix psuedo -> pseudo typo #34 (rmobis)
  • Fix typo in input pseudo-elements title #32 (viki53)

v0.8.5 (2015-10-17)

Full Changelog

Implemented enhancements:

  • Add node-pixrem to fallbacks #9

v0.8.4 (2015-10-17)

Full Changelog

v0.8.3 (2015-10-17)

Full Changelog

Closed issues:

  • Alias and font responsive not working together #25

v0.8.2 (2015-09-14)

Full Changelog

v0.8.1 (2015-09-14)

Full Changelog

v0.8.0 (2015-09-13)

Full Changelog

Implemented enhancements:

  • Create transform scale() -> zoom fallback #17

Fixed bugs:

  • Jumping issue in the documentation #23
  • Move to PostCSS 5.0 #13

Merged pull requests:

v0.7.0 (2015-09-06)

Full Changelog

v0.6.8 (2015-09-06)

Full Changelog

Implemented enhancements:

  • Add toggle options to all features #19

Closed issues:

  • Auto pesudo content fallback #18
  • Responsive font issues in IE browser (include edge) #15

v0.6.7 (2015-08-25)

Full Changelog

v0.6.6 (2015-08-21)

Full Changelog

v0.6.5 (2015-08-20)

Full Changelog

Closed issues:

  • gh-pages site should not break with HTTPS #11
  • Docs (gh-pages) #2

Merged pull requests:

v0.6.4 (2015-08-18)

Full Changelog

v0.6.3 (2015-08-15)

Full Changelog

v0.6.2 (2015-08-15)

Full Changelog

v0.6.1 (2015-08-15)

Full Changelog

Closed issues:

  • Use postcss-reporter to output plugin warnings/errors #10

v0.6.0 (2015-08-15)

Full Changelog

v0.5.3 (2015-08-08)

Full Changelog

v0.5.2 (2015-08-02)

Full Changelog

v0.5.1 (2015-08-02)

Full Changelog

v0.5.0 (2015-08-02)

Full Changelog

Closed issues:

  • Gulp wrapper #5
  • CLI tool #3

v0.4.3 (2015-08-02)

Full Changelog

Closed issues:

  • Grunt wrapper #4

v0.4.2 (2015-08-02)

Full Changelog

v0.4.1 (2015-08-02)

Full Changelog

v0.4.0 (2015-07-26)

Full Changelog

Closed issues:

  • Remove modular scale #8
  • Add postcss-responsive-type #7

v0.3.1 (2015-07-10)

Full Changelog

v0.1.1 (2015-07-10)

Full Changelog

Closed issues:

  • Write README #1

v0.3.0 (2015-07-08)

* This Change Log was automatically generated by github_changelog_generator