-
-
Notifications
You must be signed in to change notification settings - Fork 10
gulpのexample #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gulpのexample #78
Conversation
どういう仕組みが長すぎるので、StreamとVinlyで分けるべき |
今回は素のStreamでやってるけど、普通はライブラリ使うらしいと言う話が必要そう |
この[Buffer](https://nodejs.org/api/buffer.html "Buffer")は文字列オブジェクトと相互変換が可能ですが、複数の値を持ったオブジェクトを扱うのは少し大変です。 | ||
|
||
そのため、Node.js Streamには[Object Mode](https://nodejs.org/api/stream.html#stream_object_mode "Object Mode")があり、 | ||
JavaScriptのオブジェクトそのものをStreamで流せるようになっています。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この"JavaScriptのオブジェクト"という表現良くない気がする。
generic JavaScript values other than Buffers and Strings.
// Outputs vinyl File objects | ||
readableObjectMode: true, | ||
transform: function (file, encoding, next) { | ||
if (file.isBuffer()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一応Null対応も欲しい?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
公式も省いてるからいいや
#16 のExampleコード
他の章にならってとりあえず直接Streamを書いてるんだけど、gulpはgulp向けstreamとstreamライブラリを組み合わせて使うもんなんだなという理解をした。
gulpのExampleとしてはかなり良くないけどどうするべきか。(動きを理解するものとしては何も抽象化されてないので分かる感じ