Skip to content

Commit 802ed90

Browse files
committed
readme, badges
1 parent 9986850 commit 802ed90

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

.coveralls.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
service_name: travis-pro
2+
repo_token: KfDtZaE5IHPtRZVkKP2Mw9BmYRo5yZ0dg

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: node_js
22
node_js:
3+
- "5"
34
- "4"
45
- "0.12"
56
- "0.11"

README.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,129 @@
11
# reduce-postcss
22
Plugin for [reduce-css](https://github.com/zoubin/reduce-css) to pack postcss modules.
3+
4+
[![npm](https://nodei.co/npm/reduce-css-postcss.png?downloads=true)](https://www.npmjs.org/package/reduce-css-postcss)
5+
6+
[![version](https://img.shields.io/npm/v/reduce-css-postcss.svg)](https://www.npmjs.org/package/reduce-css-postcss)
7+
[![status](https://travis-ci.org/zoubin/reduce-css-postcss.svg?branch=master)](https://travis-ci.org/zoubin/reduce-css-postcss)
8+
[![coverage](https://img.shields.io/coveralls/zoubin/reduce-css-postcss.svg)](https://coveralls.io/github/zoubin/reduce-css-postcss)
9+
[![dependencies](https://david-dm.org/zoubin/reduce-css-postcss.svg)](https://david-dm.org/zoubin/reduce-css-postcss)
10+
[![devDependencies](https://david-dm.org/zoubin/reduce-css-postcss/dev-status.svg)](https://david-dm.org/zoubin/reduce-css-postcss#info=devDependencies)
11+
12+
## Example
13+
14+
See files in the example directory.
15+
16+
```javascript
17+
var gulp = require('gulp')
18+
var del = require('del')
19+
var reduce = require('reduce-css')
20+
var postcss = require('reduce-css-postcss')
21+
var path = require('path')
22+
var fixtures = path.resolve.bind(path)
23+
24+
gulp.task('clean', function () {
25+
return del('build')
26+
})
27+
28+
gulp.task('single-bundle', ['clean'], function () {
29+
return reduce
30+
.on('error', console.log.bind(console))
31+
.on('log', console.log.bind(console))
32+
.on('instance', function (b) {
33+
b.plugin(postcss)
34+
})
35+
.src('*.css', {
36+
basedir: fixtures('src'),
37+
factor: 'common.css',
38+
})
39+
.pipe(reduce.dest('build', null, {
40+
maxSize: 0,
41+
assetOutFolder: fixtures('build', 'images'),
42+
}))
43+
})
44+
45+
gulp.task('watch-single-bundle', ['clean'], function () {
46+
reduce.watch()
47+
.on('error', console.log.bind(console))
48+
.on('log', console.log.bind(console))
49+
.on('instance', function (b) {
50+
b.plugin(postcss)
51+
})
52+
.src('*.css', {
53+
basedir: fixtures('src'),
54+
factor: 'common.css',
55+
})
56+
.pipe(reduce.dest, 'build', null, {
57+
maxSize: 0,
58+
assetOutFolder: fixtures('build', 'images'),
59+
})
60+
})
61+
62+
gulp.task('multiple-bundles', ['clean'], function () {
63+
return reduce
64+
.on('error', console.log.bind(console))
65+
.on('log', console.log.bind(console))
66+
.on('instance', function (b) {
67+
b.plugin(postcss)
68+
})
69+
.src('*.css', {
70+
basedir: fixtures('src'),
71+
factor: {
72+
needFactor: true,
73+
common: 'common.css',
74+
},
75+
})
76+
.pipe(reduce.dest('build', null, {
77+
maxSize: 0,
78+
useHash: true,
79+
assetOutFolder: fixtures('build', 'images'),
80+
}))
81+
})
82+
83+
gulp.task('watch-multiple-bundles', ['clean'], function () {
84+
reduce.watch()
85+
.on('error', console.log.bind(console))
86+
.on('log', console.log.bind(console))
87+
.on('instance', function (b) {
88+
b.plugin(postcss)
89+
})
90+
.src('*.css', {
91+
basedir: fixtures('src'),
92+
factor: {
93+
needFactor: true,
94+
common: 'common.css',
95+
},
96+
})
97+
.pipe(reduce.dest, 'build', null, {
98+
maxSize: 0,
99+
useHash: true,
100+
assetOutFolder: fixtures('build', 'images'),
101+
})
102+
})
103+
104+
105+
```
106+
107+
## options
108+
109+
### processorFilter
110+
Type: `Function`
111+
112+
Receive a [pipeline](https://github.com/zoubin/postcss-processor-splicer) instance,
113+
through which you can add, remove, or customize postcss plugins to apply.
114+
115+
Type: `Array`
116+
117+
Specify extra postcss plugins to apply.
118+
119+
#### Default plugins
120+
121+
* [postcss-simple-import](https://github.com/zoubin/postcss-simple-import)
122+
* [postcss-custom-url](https://github.com/zoubin/postcss-custom-url)
123+
* [postcss-advanced-variables](https://github.com/jonathantneal/postcss-advanced-variables)
124+
* [postcss-mixins](https://github.com/postcss/postcss-mixins)
125+
* [postcss-nested](https://github.com/postcss/postcss-nested)
126+
* [postcss-extend](https://github.com/travco/postcss-extend)
127+
* [autoprefixer](https://github.com/postcss/autoprefixer)
128+
129+

0 commit comments

Comments
 (0)