Skip to content

fix #17: add a stream output option #51

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

Merged
merged 3 commits into from
Oct 12, 2015

Conversation

joeybaker
Copy link
Contributor

The bundle now emits a ’css stream’ event. Users can listen to this and
get a stream of the compiled CSS.

I’m not a super big fan of this API, but I couldn’t think of a better way
to give access to the stream.

fixes #17

* ensures that the transform is called on each file
* ensures the default class names contain folder names
b/c tape internals are nice :)
The `bundle` now emits a `’css stream’` event. Users can listen to this
and get a stream of the compiled CSS.

I’m not a super big fan of this API, but I couldn’t think of a better
way to give access to the stream.
@joshwnj
Copy link
Member

joshwnj commented Oct 11, 2015

Looks good! I suppose another way would be to add to the css-modulesify API rather than adding a new event to browserify. Eg.

var cssModulesify = require('css-modulesify')

b.plugin(cssModulesify, {
  rootDir: __dirname,
  onCss: function (css) {
    css.pipe(fs.createWriteStream('mycss.css'))
  }
})

Thoughts on pros/cons of either approach?

@joeybaker
Copy link
Contributor Author

True! I kinda like attaching things to bundle() because it's nice to have all the file-writing located in one place in the code. I'm not really attached to either way though.

@joshwnj
Copy link
Member

joshwnj commented Oct 11, 2015

Sure, that's a fair point. I am also not terribly fussed either way. Before we go ahead, do you know of any other plugins that emit their own custom events from bundle?

@joeybaker
Copy link
Contributor Author

Heh… without going on a search, the only one I know of is my own remapify :)

@joshwnj
Copy link
Member

joshwnj commented Oct 12, 2015

Heh cool :) Will merge this for now. When we come to finalize the 1.0 release I'd like to find concrete usage examples to account for every feature, and make sure we have a consistent API. So we might want to revise it then.

Thanks!

joshwnj added a commit that referenced this pull request Oct 12, 2015
fix #17: add a stream output option
@joshwnj joshwnj merged commit 1a77505 into css-modules:master Oct 12, 2015
@joshwnj
Copy link
Member

joshwnj commented Oct 12, 2015

Published v0.10.0

@joeybaker
Copy link
Contributor Author

Cheers. BTW, if you're ever looking for more maintainers, I'd be happy to lend a hand.

@joeybaker joeybaker deleted the add-streaming branch October 12, 2015 03:37
@joshwnj
Copy link
Member

joshwnj commented Oct 13, 2015

Thanks! I'd like to add more maintainers when we finalize our v1.0 plans, so we'd definitely love to take you up on your offer :) Will let you know when that starts moving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature request: ability to get output as a stream
2 participants