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

Why Gulp? #12

Closed
myndzi opened this issue Feb 21, 2016 · 5 comments
Closed

Why Gulp? #12

myndzi opened this issue Feb 21, 2016 · 5 comments

Comments

@myndzi
Copy link

myndzi commented Feb 21, 2016

This project looks interesting, but I'm confused as to why both Webpack and Gulp are in use. Why not use Webpack to produce distribution builds?

@jokeyrhyme
Copy link
Contributor

Gulp and Webpack have different responsibilities

  • Gulp is a task automation framework
  • Webpack is a build system, which happens to be set up here as a Gulp task

Not unusual to use both, although I'm see more and more projects skip Gulp and just use npm scripts instead

@myndzi
Copy link
Author

myndzi commented Feb 22, 2016

Thanks for the response. I do understand the distinction; perhaps I should clarify my question: what is gulp doing that webpack (and/or possibly some npm scripts) can't, or is bad at?

@jokeyrhyme
Copy link
Contributor

Of everything mentioned so far, npm scripts are the only alternative to gulp. webpack is not a task framework.

Gulp is theoretically more efficient than npm scripts, in that it can pass file contents through multiple pipelines, avoiding unnecessary disk writes in between. I also like that gulp tasks can describe their dependencies, and gulp will execute them in the best order. Also, gulp and grunt tend to have fewer cross-platform issues than pure npm scripts.

That said, many of my projects just use npm scripts, because it's so easy to get started. /shrug

@myndzi
Copy link
Author

myndzi commented Feb 23, 2016

Well your gulpfile is pretty straightforward, to the point it almost seemed unnecessary, and it was doing some of webpack's job in terms of manipulating the content and output of files; that's what prompted the question. (I don't know Webpack well enough, but it seems that the CSS portion is a bit hasslesome when building a distribution.) The question was less from a perspective of "why are you doing this unnecessary thing", and more from a perspective of "what necessitated doing it this way".

Anyway, no need to keep an issue open, I was just asking for some insight into the design choices here and I thought it might be worth having a documented answer for other people to run into, too :)

@myndzi myndzi closed this as completed Feb 23, 2016
@jamesknelson
Copy link
Owner

@myndzi Good question. Back when I wrote my build scripts, webpack's plugin for generating index.html was either unknown or non-existent (not sure which one). Thus the gulp script.

I could convert things to use that plugin, but I honestly don't think this should be the responsibility of Webpack. Webpack is a module bundler, not a HTML file generator. And as @jokeyrhyme mentioned, gulp is useful for running tasks anyway, so I've left it in there.

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

3 participants