Skip to content
bebraw edited this page Apr 21, 2013 · 2 revisions

Eventually you'll end up needing to set up some kind of a build system for your project. You'll likely want to use a different build for development and production for instance. There also may be multiple targets ranging from mobile to desktop (each might have different dependencies).

In addition you might have some extra dependencies (such as some CSS precompiler) in your project. So during development you might need to run the precompiler in a watch mode. And you might want to have LiveReload server running as well.

As you can see it can get quite complicated, fast. This is the reason why multiple build systems have emerged. grunt is perhaps the most popular, or at least visible, option for Node.js. You can definitely use it on a pure frontend project. Node.js just happens to be the platform it runs on.

Grunt

In grunt you define specific tasks for particular purposes (ie. running that LiveReload server). It is possible to run multiple of these tasks at the same time. And it is possible to define custom tasks and plugins based on your needs.

I won't go into details. Rather examine Grunt documentation and an example project I've set up. The example project is sort of meta in sense that you can use it as a base for your own GitHub based library project.

grunt tends to develop quite fast. In the past this lead to some breakage when newer versions of the tool came out. Remember to refer to a specific version of Grunt in your package.json to avoid this group of problems.

Conclusion

In this chapter I highlighted the importance of build systems and discussed one, Grunt. It is a very good idea to use this type of tool. It may seem like a lot of work initially but it streamlines development somewhat as pretty much all you need to do is to type grunt and you've got a development server running that is smart enough to support your workflow. This lets you focus on real problems rather than having to spend too much time at the terminal.

Clone this wiki locally