

Grunt.js: Tips and Tricks - missbikesalot
http://quickleft.com/blog/grunt-js-tips-tricks

======
Brajeshwar
[http://webcache.googleusercontent.com/search?q=cache:http://...](http://webcache.googleusercontent.com/search?q=cache:http://quickleft.com/blog/grunt-
js-tips-tricks&espv=210&es_sm=119&strip=1)

~~~
AlexMcP
Site's back up, we scaled up some dynos. Thanks Heroku :-)

------
ville
The article suggests splitting the configuration in many parts using the
grunt.config method. Another interesting way to organize it in a larger
project is to define config for each task in a separate module. I first saw
this used in React:
[https://github.com/facebook/react/blob/9182100/Gruntfile.js#...](https://github.com/facebook/react/blob/9182100/Gruntfile.js#L17)

~~~
akbar501
It's important to note that Grunt can be used in 2 (more?) ways:

1.) As a build tool

2.) As a continuous build tool (with watch and live reload)

React's Gruntfile is well organized and is a great option for #1.

However, use of this approach for #2 will cause a slower development process.
Obviously, part of the performance hit could be offset by conditionally
including only the files required for each task. However, reading files from
disk will result in a slower reload.

------
Kiro
Can someone please tell me what exactly they are using Grunt for? I just don't
see what problem it solves.

~~~
bichiliad
I'm using it to automate testing/concatenating/minifying a front-end library
I'm working on.

~~~
dougbarrett
I 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

------
Xdes
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
I 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.

------
tapsboy
HN continues to amaze me. I was just looking for a solution to creating
multiple build files using grunt and requirejs. Found out how exactly under
the "Dynamic Tasks" section.

------
coley
I know this is off-topic, but I really liked this site's page title banner
interaction. I haven't seen anything like it before!

