3 ms·
Grunt has done nothing, but piss me off since I've used it. The one plugin that it is missing is a JS library dependency resolver (put in the file paths, put in
by Xdes 13y ago
Grunt has done nothing, but piss me off since I've used it. The one plugin that it is missing is a JS library dependency resolver (put in the file paths, put in the dependencies, and spit out the file paths in the optimal load order). I've used grunt standalone (which sucked when I spent half the day in the config), I've used it with Yeoman (which suffers the same problem as using Grunt standalone), and I've used it with Lineman (which essentially sidesteps the problem by concatenating all the files together in an order you specify).
Grunt is simply too complicated for a lightweight such as myself and I wish the tooling existed to make the pain go away.
- hootener 13y agoI feel your pain with JS dependency resolution and management, I have yet to get it with grunt, either. I solved that problem with RequireJS. Have you given that a shot? RequireJS is incredible when it comes to managing dependencies and organizing JS code in general. Combine it with a requirejs task in Grunt to automatically optimize your JS code and you've got a real slick development-to-production JS pipeline on your hands. Granted, RequireJS may seem a little funky at first, but I promise you taking the couple of hours necessary to learn its basics will make your life (at least when it comes to developing JS) much easier.
- tieTYT 13y agoYeah I totally agree with you here. I had to come up with my own solution to this which took a lot of mental effort. Basically I leveraged the grunt-include-replace* plugin to specify a variable in my template file. This variable gets expanded to all the files I depend on. I specify those files with a grunt globbing pattern. There's some logic in between this that converts the file path to script tags. I really hate the amount of effort this took but it was worth it. I feel like this should be a first class feature/plugin. The problem with lineman's solution is that when you concatenate everything, your stack traces are obfuscated. EG: "An error occurred on line 1,000,000 of concatenated.js". Also, it slows your feedback loop to wait for the concatenation to occur. Also it slows my IDE to view and index a huge concatenated file. Another thing I hate about grunt's watch plugin is how much code it takes to make the watch plugin only act on the changed files instead of all the files it's watching. EG: When a coffeescript file changes, only compile that file, not all the coffeescript files. That takes like 5 lines of code. It should be an option I can set to true. * https://github.com/alanshaw/grunt-include-replace https://github.com/alanshaw/grunt-include-replace