Skip to content
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

built-in plugins concat and clear #53

Closed
iamstarkov opened this issue Jul 22, 2015 · 7 comments
Closed

built-in plugins concat and clear #53

iamstarkov opened this issue Jul 22, 2015 · 7 comments

Comments

@iamstarkov
Copy link
Contributor

why does we need it inside? https://github.com/flyjs/fly/blob/master/src/fly.js#L134-L149

@MadcapJake
Copy link

Because those are the basic building blocks of task automation. Keeping basic functions like that inside fly adds to the uniformity of the API. Fly has relatively specific space for plugins and what they can do which gives them power and keeps them reined in as well. Pushing all functionality out into plugins would detract from the clarity, add to the user ramp-up process, and potentially cause trouble when debugging.

@iamstarkov
Copy link
Contributor Author

gulp has bad experience even with "watch" encapsulation. that’s why we have https://github.com/floatdrop/gulp-watch

@iamstarkov
Copy link
Contributor Author

anyway, if someone is not happy with current implementationы, then is it possible to rewrite current concat and clear implementations?

@ghost
Copy link

ghost commented Jul 22, 2015

@iamstarkov Thanks for the question! Basically, what @MadcapJake said 😄

Don't you think that stuff like watch, concat, and clear (and possibly rename, move and copy) would be just nice to have out of the box?. Which ones should specifically be built into core is open to debate.

Now, most people will probably use watch, clear and concat so I think they deserve to be in core, thus I built it like so.

@iamstarkov What was gulp's bad experience? I am not familiar with the issue.

@iamstarkov
Copy link
Contributor Author

long story short: built-in watch was not good enough, thats why gulp ecosystem has external gulp-watch. I’m wondering is it possible to replace built-in utils with external ones, if somebody will want it?

@MadcapJake
Copy link

I'm not sure about concat but I think a custom clear would be relatively easy to write as a plugin (Though I don't really know any specifics on deleting files via node).

@ghost
Copy link

ghost commented Jul 22, 2015

I’m wondering is it possible to replace built-in utils with external ones, if somebody will want it?

anyway, if someone is not happy with current implementationы, then is it possible to rewrite current concat and clear implementations?

Override the method:

export default function* () {
  this.concat = ...
}

Now, since you brought this up, I think a more natural way to do this would be using the same method that concat uses internally to add itself to the collection of writers. I haven't tested this, but ideally you should be able to:

export default function* () {
  this.write("concat", Function)
  ...
  ...
}

Regarding writers

concat is simply a writer, basically that's code that runs after the sequence started by Fly.proto.source() unwraps and the incoming source of data is reduced to something.

At this point you can use Fly.proto.write(Function) to do whatever you want. concat does the same thing as Fly.proto.target, but instead of rewriting each of the files the globs expanded to, it simply appends the data to a single file ignoring the expanded globs.

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

No branches or pull requests

2 participants