Gulp VS Grunt


Just wondering if there is particular JS build system preferred when using Yii2.

There is a documented section here on using Grunt, and a todo section for Gulp. Once the todo is done for Gulp, would that be the preferred JS build system? Or more generally, to people here think one is preferred over the other?


I don’t think there’s a preferred one or Yii framework can affect your choice significantly. I use Grunt and I’m happy with it (mostly because I’m already familiar with it and, since Grunt does the job, I don’t want to learn another tool at the moment) but others reportedly use Gulp without any problem.


If you already have some experience with Grunt or Gulp then you don’t really need any Yii-specific knowledge. The tasks and configuration options described by the linked cookbook page are commonly used ones.

I am probably biased, but I prefer Gulp :)

It is used in the new (upcoming) Yii website ->

Check out this topic -> http://www.yiiframew…gulp-toolchain/

And maybe this blog post ->


Gulp vs Grunt boils down to preference:

Do you prefer configuration over code?

In practice, Gulp is much faster than Grunt because it can work in parallel and because it is based on streams.

Grunt can probably do some kind of parallel-ism, I haven’t looked into it recently.

Either way, Yii does not care. ;)

Both are OK. Yii isn’t biased in favor of one or another. I’m using Grunt daily in build system and there’s Gulp in new as jacmoe mentioned. When using Yii 2.0 both are configured by the same principle i.e. turning off regular PHP-based assets publishing then using JS-tools. Gulp definitely feels significantly faster than grunt but gave me significant trouble installing it for the first time (well, beacause I did it on Windows).

Thanks for the great replies!

I kind of thought that it was a case of 6 on one side half a dozen the other.

@phtamas, yes I know the feeling of not wanting to get familiar with one thing and than all of a sudden there is a new flavor of the month. I was worried one or the other was like a GIT vs Subversion (different, but still one is better).

@jacmoe, Thanks for the link to the article and the point about how it will be used in the upcoming Yii website.

@samdark, At least the consensus is that it is more about what you are familiar with and the particular bias one for the other than straight up solid arguments one over the other. As an aside, when will they add ‘Canberra Australia’ to the list of cities on the website :P

That said and since I have done next to nothing with either, I might take a look at Gulp, and specifically Gulp 4 when it comes out.

Thanks for the constructive feedback.


johnsnails, new cities aren’t added fast becuase it’s all done by editors and local experts, not by community, to ensure quality (yeah, I know that’s questionable).

Thats fair (and overall a good way). I just wanted to drop it in there since I was using the app recently :P