4 ms·
Can someone please tell me what exactly they are using Grunt for? I just don't see what problem it solves.
by Kiro 13y ago
Can someone please tell me what exactly they are using Grunt for? I just don't see what problem it solves.
- donut2d 13y agoI'm using it to automatically watch for changes to CoffeeScript and SASS files and then run the appropriate preprocessor when they change and tell my browser to refresh via LiveReload.
- bichiliad 13y agoI'm using it to automate testing/concatenating/minifying a front-end library I'm working on.
- dougbarrett 13y agoI do the same with a PHP project, it's nice because I just don't include the original JS source files when I push to staging/production
- AlexMcP 13y agoI use it outside of a Rails project when I don't have the asset pipeline available in my tool chain. It gives me the scalpel to define exactly what happens to my code and files vs. a one-size-fits-all option like LiveReload or Brunch where I need to match a specific filesystem layout.
- mikewhy 13y agoShould be noted that paths in brunch aren't set in stone. app/ gets some special treatment is all. For instance our current project has app.js, vendor.js, test.js, test-vendor.js, admin.js, admin-vendor.js
- tieTYT 13y agoI wish you would have elaborated on your question because it seems pretty obvious to me and I'm not sure what your experience level is (or what language you're using). Or maybe you're thinking, "I don't get the point of Grunt, isn't X better?" I can't tell. Grunt is to JavaScript as Ant is to Java. "The main usage of Ant is to build Java applications." So, "The main usage of Grunt is to build JavaScript applications". I'm making a game and I use it for many different tasks: 1. Every time a coffeescript file changes, compile that file to javascript 2. Every time a js file is added or deleted, change the list of script tags in the html file 3. Every time a sass file changes, run compass to compile it into a css file 4. I've got a test suite (qunit, it runs off an html file) that uses the same script list that my main game uses (and more). I've turned the script list into a variable so I don't have to modify either html file by hand if I add/remove a coffeescript file. 5. Every time a js file changes, is added or deleted, run unit tests in the background using phantomjs 6. If a unit test fails, beep 3 times 7. Every time a coffescript file changes, is added or deleted, reload the page so I can see my change. This is configurable so I can turn this feature off. 8. When I build for production, concatenate all the files and minify them. 9. Every time any file changes, update the html file to have a new build-time variable. I would be super unproductive if I had to do these tasks by hand. Grunt.js lets me automate these tasks and reuse them as many times as I want. For example, I used to run my qunit tests by hand by going to the .html file and refreshing the browser. But sometimes I forgot or I didn't want to lose my train of thought. Sometimes this would lead to me accidentally committing broken code. That's why I automated the tests to run in the background whenever a file changes. Now I can't forget to run the unit tests and I don't have to lose my train of thought.