-
Notifications
You must be signed in to change notification settings - Fork 310
Use jit-grunt instead of grunt-load-tasks? #540
Comments
Out of curiosity, which plugin name doesn't match? |
That's incorrect.
No good reason to do that.
Why? And how does
Where are the numbers? Last time we had this discussion the numbers where negligible and variable. |
+1 for Build task with Build task with The performance gain is even more significant when running a task after a long break. Loading of tasks with You should include |
Firstly, excuse my slowness replying. @sindresorhus: Ok, good point, sorry - I was wrong about grunt-load-task's plugin matching. To be honest, though, I probably overemphasised that aspect - it happens that I struggled a bit to get assemble working with grunt-load-tasks, when it seems it would have worked out of the box with jit-grunt. The main advantage of jit-grunt really is the significant speed improvement; my point in raising the configuration issue was that last time this was discussed it seems that jit-grunt was rejected as being potentially more difficult to configure than grunt-load-tasks. My point really was that at this point there's no very clear difference in complexity between them, so it might be worth reconsidering jit-grunt on the merits of its speed. As for speed, with every project I've compared them on, jit-grunt has been significantly faster. If you're comparing them, bear in mind that the difference is likely to be proportionally greater on, eg. watch tasks than on build tasks, since jit-grunt saves time by only loading tasks as they're needed (so when you, say, edit a watched Javascript file, it only load the JS-related tasks). For "build"-type tasks, I'd expect there to be less difference (since jit-grunt will have to load most or all tasks anyway), but even there my experience has generally been in line with @marian-r's. For watch tasks, I've found jit-grunt is consistently a couple of seconds faster - very noticeable when live-reloading. |
...In summary, my point was since: |
Agree with @nickautomatic
|
We would appreciate a PR. Otherwise we'll implement this when we have time. |
Here it is #554 :) And I would recommend using |
Yes, you can, it's clearly faster. |
This has previously been discussed but was rejected because at the time it was felt that jit-grunt was harder to configure. However, since then jit-grunt seems to have come along a bit, and it is now arguably no more complex to configure, while leading to very significant speed improvements. I wonder if it would be worth another look?
The advantage of grunt-load-tasks is that because it loads all plugins (named "grunt-") by default, it works ok where task names don't match a plugin (eg. "useminPrepare" --> "grunt-usemin"). However, it doesn't load plugins with names like "grunt-contrib-" or just "*" by default.
jit-grunt maps to all three of the above patterns by default, so will find some plugins (eg. "assemble") that grunt-load-tasks doesn't out of the box. However, it does require configuration where the task name doesn't match a plugin (eg. useminPrepare).
Speaking as a relative beginner with Grunt / node.js myself, I found it difficult to figure out how to configure load-grunt-tasks to work with a plugin whose name doesn't match load-grunt-task's default mapping. If generator-webapp used jit-grunt you'd have a working example -- commented, even -- in the default Gruntfile that would make it clear how to add new plugins / tasks. Something like:
...admittedly a little more complex as a default, but by being explicit rather than implicit, probably not actually worse (and arguably even perhaps better) for beginners. Anyway, just a thought / suggestion. For me it doesn't feel like there's that much in it in terms of complexity, and jit-grunt's significant speed improvements certainly make working with grunt more pleasant, on my machine anyway.
(See also discussion here)
The text was updated successfully, but these errors were encountered: