Skip to content

Commit

Permalink
document new task runners. fixes #4 #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean King committed Aug 2, 2015
1 parent 4e8e5db commit f2f68b8
Showing 1 changed file with 56 additions and 58 deletions.
114 changes: 56 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,70 +28,72 @@ $ npm install --save rucksack-css postcss

### Usage

General usage:

1. Add [PostCSS][postcss] to your build workflow
2. Include Rucksack as a PostCSS plugin

<br/>

###### Node
###### Gulp
Use [gulp-rucksack][gulp-rucksack]
```js
var postcss = require('postcss'),
rucksack = require('rucksack-css');
var gulp = require('gulp');
var rucksack = require('gulp-rucksack');

postcss([ rucksack() ])
.process(css, { from: 'src/style.css', to: 'style.css' })
.then(function (result) {
fs.writeFileSync('style.css', result.css);
if ( result.map ) fs.writeFileSync('style.css.map', result.map);
});
```
gulp.task('rucksack', function() {
return gulp.src('src/style.css')
.pipe(rucksack())
.pipe(gulp.dest('style.css'));
});```
<br/>
###### Gulp
Use [gulp-postcss][gulp-postcss]
###### Grunt
Use [grunt-rucksack][grunt-rucksack]
```js
var postcss = require('gulp-postcss'),
rucksack = require('rucksack-css');
require('load-grunt-tasks')(grunt);

gulp.task('css', function () {
return gulp.src('src/*.css')
.pipe( postcss([ rucksack() ]) )
.pipe( gulp.dest('.') );
grunt.initConfig({
rucksack: {
compile: {
files: {
'style.css': 'src/style.css'
}
}
}
});

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

<br/>

###### Grunt
Use [grunt-postcss][grunt-postcss]
###### Broccoli
Use [broccoli-rucksack][broccoli-rucksack]

```js
grunt.initConfig({
css: {
options: {
processors: [require('rucksack-css')]
},
dist: {
src: 'src/*.css'
}
}
});
var rucksack = require('broccoli-rucksack');
tree = rucksack(tree, [options]);
```

<br/>

###### CLI
Use [PostCSS CLI][postcss-cli] to process CSS on the command line
```sh
$ postcss --use rucksack-css -o style.css style.css
###### PostCSS
Rucksack is built on PostCSS, and can be used as a PostCSS plugin.

```js
var postcss = require('postcss'),
rucksack = require('rucksack-css');

postcss([ rucksack() ])
.process(css, { from: 'src/style.css', to: 'style.css' })
.then(function (result) {
fs.writeFileSync('style.css', result.css);
if ( result.map ) fs.writeFileSync('style.css.map', result.map);
});
```
See the [PostCSS Docs][postcss] for examples for your environment.

<br/>
<br/>

###### Stylus
Use Rucksack as a Stylus plugin with [PostStylus][poststylus]
Use Rucksack directly as a Stylus plugin with [PostStylus][poststylus]

```js
stylus(css).use(poststylus('rucksack-css'))
```
Expand All @@ -102,22 +104,22 @@ See the [PostStylus Docs][poststylus] for more examples for your environment.

### Core Features

_Shorthand syntax for positioning properties_
_Automagical responsive typography_
```css
.foo {
absolute: 0 20px;
relative: 20% 0 30px;
font-size: responsive;
}
```
![Responsive Type Demo][type-demo]

_Automagical responsive typography_

_Shorthand syntax for positioning properties_
```css
.foo {
font-size: responsive;
absolute: 0 20px;
relative: 20% 0 30px;
}
```
![Responsive Type Demo][type-demo]


_Native clearfix_
```css
Expand Down Expand Up @@ -179,8 +181,6 @@ _CSS property aliases_
###### Autoprefixing
Automatically apply vendor prefixes to relevant properties based on data from [CanIUse][caniuse].

###### Normalization
Automatically apply the latest Normalize.css stylesheet to standardize browser inconsistencies.

###### Legacy Fallbacks
Automatically insert legacy fallbacks for modern properties.
Expand Down Expand Up @@ -225,8 +225,6 @@ Pass booleans to toggle optional extras on/off

`autoprefixer`: Toggle autoprefixing on/off (default: `true`).

`normalize`: Toggle normalizing on/off (default: `false`).

`fallbacks`: Toggle legacy fallbacks on/off (default: `true`).

`colors`: Toggle color replacements on/off (default: `true`).
Expand All @@ -244,10 +242,10 @@ MIT © [Simpla][simpla]

[simpla]: http://simpla.io
[postcss]: https://github.com/postcss/postcss
[gulp-postcss]: https://github.com/postcss/gulp-postcss
[grunt-postcss]: https://github.com/nDmitry/grunt-postcss
[postcss-cli]: https://github.com/code42day/postcss-cli
[poststylus]: https://github.com/seaneking/poststylus
[gulp-rucksack]: https://github.com/simplaio/gulp-rucksack
[grunt-rucksack]: https://github.com/simplaio/grunt-rucksack
[broccoli-rucksack]: https://github.com/simplaio/broccoli-rucksack
[poststylus]: https://github.com/simplaio/poststylus
[type-demo]: /type-demo.gif?raw=true
[fontspring]: http://blog.fontspring.com/2011/02/further-hardening-of-the-bulletproof-syntax/
[caniuse]: http://caniuse.com
Expand Down

0 comments on commit f2f68b8

Please sign in to comment.