Skip to content

Commit

Permalink
Add usage example of conventional streams
Browse files Browse the repository at this point in the history
- Refs #2
  • Loading branch information
pascalduez committed Dec 28, 2014
1 parent 723723d commit 38e6cc0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ gulp.task('sassdoc', function () {
});
```

```js
var fs = require('fs');
var vfs = require('vinyl-fs');
var source = require('vinyl-source-stream');
var rename = require('gulp-rename');

fs.createReadStream('./file.sass')
.pipe(source('file.sass'))
.pipe(converter({
from: 'sass',
to: 'scss',
}))
.pipe(rename('file.scss'))
.pipe(vfs.dest('./'));
```

## Credits

* [Pascal Duez](https://twitter.com/pascalduez)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"runtime": "mkdir -p bin && cp node_modules/traceur/bin/traceur-runtime.js bin/traceur-runtime.js",
"lint": "eslint lib/*.js",
"test": "tape test/*.test.js | faucet",
"pretest": "$npm_package_scripts_prepublish",
"prepublish": "npm run dist && npm run runtime",
"inspect": "node test/inspect.js"
}
Expand Down
16 changes: 15 additions & 1 deletion test/inspect.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'use strict';

var through = require('through2');
var fs = require('fs');
var vfs = require('vinyl-fs');
var through = require('through2');
var source = require('vinyl-source-stream');
var rename = require('gulp-rename');

require('traceur-runner');
var converter = require('../lib');
Expand All @@ -21,3 +24,14 @@ vfs.src('./test/fixture/input/**/*.+(sass|scss|css)')
.on('error', console.error)
.pipe(inspect())
.pipe(vfs.dest('./test/output'));

fs.createReadStream('./test/fixture/input/sass/one.sass')
.pipe(source('one.sass'))
.pipe(converter({
from: 'sass',
to: 'scss',
}))
.on('error', console.error)
.pipe(inspect())
.pipe(rename('one.scss'))
.pipe(vfs.dest('./test'));

0 comments on commit 38e6cc0

Please sign in to comment.