Skip to content

Commit dda7da3

Browse files
committed
use transform
1 parent 2b5722a commit dda7da3

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ like [browserify](http://browserify.org/) does.
1111
## Features
1212
- __clarity:__ namespace CSS, no more need for naming schemes
1313
- __modularity:__ import and reuse CSS packages from npm
14-
- __extensibility:__ transform CSS using existing plugins, or write your own
14+
- __extensibility:__ transform CSS using existing transforms, or write your own
1515
- __transparency:__ inline CSS in your views
1616
- __simplicity:__ tiny API surface and a minimal code base
1717

@@ -140,8 +140,8 @@ $ browserify index.js \
140140
[css-extract][2] can also write to a stream from the JS api, look at the
141141
documentation to see how.
142142

143-
## Plugins
144-
Sheetify uses [plugins](#plugins) that take CSS and apply a transform.
143+
## Transforms
144+
Sheetify uses [transforms](#transforms) that take CSS and apply a transform.
145145
For example include
146146
[sheetify-cssnext](https://github.com/sheetify/sheetify-cssnext) to support
147147
autoprefixing, variables and more:
@@ -164,9 +164,9 @@ const tree = html`
164164
document.body.appendChild(tree)
165165
```
166166

167-
Compile with browserify using `-t [ sheetify -u sheetify-cssnext ]`:
167+
Compile with browserify using `-t [ sheetify -t sheetify-cssnext ]`:
168168
```sh
169-
$ browserify -t [ sheetify -u sheetify-cssnext ] index.js > bundle.js
169+
$ browserify -t [ sheetify -t sheetify-cssnext ] index.js > bundle.js
170170
```
171171

172172
Transforms the CSS into:
@@ -177,15 +177,11 @@ h1 {
177177
}
178178
```
179179

180-
The following plugins are available:
181-
- [sheetify-cssnext](https://github.com/sheetify/sheetify-cssnext) - use
182-
tomorrow's CSS syntax today
183-
184180
## API
185181
Browserify transforms accept either flags from the command line using
186182
[subargs](https://github.com/substack/subarg):
187183
```sh
188-
$ browserify -t [ sheetify -u sheetify-cssnext ] index.js > bundle.js
184+
$ browserify -t [ sheetify -t sheetify-cssnext ] index.js > bundle.js
189185
```
190186

191187
Or the equivalent options by passing in a configuration object in the
@@ -194,14 +190,14 @@ JavaScript API:
194190
const browserify = require('browserify')
195191

196192
const b = browserify(path.join(__dirname, 'transform/source.js'))
197-
b.transform('sheetify', { use: [ 'sheetify-cssnext' ] })
193+
b.transform('sheetify', { transform: [ 'sheetify-cssnext' ] })
198194
b.bundle().pipe(process.stdout)
199195
```
200196

201197
The following options are available:
202198
```txt
203199
Options:
204-
-u, --use Consume a sheetify plugin
200+
-t, --transform Consume a sheetify transform
205201
```
206202

207203
## FAQ

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ function parseCss (src, filename, prefix, options, done) {
8282
// one at the time
8383
// (str, str, obj, fn) -> null
8484
function applyTransforms (filename, src, options, done) {
85-
options.use = [].concat(options.use || []).concat(options.u || [])
86-
mapLimit(options.use, 1, iterate, function (err) {
85+
options.transform = [].concat(options.transform || []).concat(options.t || [])
86+
mapLimit(options.transform, 1, iterate, function (err) {
8787
if (err) return done(err)
8888
done(null, src)
8989
})

test/plugins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test('plugins', function (t) {
2323
const bpath = path.join(__dirname, 'fixtures/plugins-source.js')
2424
browserify(bpath, bOpts)
2525
.transform(sheetify, {
26-
use: [ [ 'sheetify-cssnext', { sourcemap: false } ] ]
26+
transform: [ [ 'sheetify-cssnext', { sourcemap: false } ] ]
2727
})
2828
.transform(function (file) {
2929
return through(function (buf, enc, next) {

transform.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ function transform (filename, options) {
1818

1919
const opts = xtend(options || {
2020
basedir: process.cwd(),
21-
use: [],
21+
transform: [],
2222
out: ''
2323
})
2424

25-
opts.use = [].concat(opts.use || []).concat(opts.u || [])
25+
opts.transform = [].concat(opts.transform || []).concat(opts.t || [])
2626

2727
const bufs = []
2828
const transformStream = through(write, end)

0 commit comments

Comments
 (0)