How to Grunt !!!

Grunt WorkFlow

Grunt is a task-based command line build tool for JavaScript projects. Here’s the idea: when working on a JavaScript project, there are a bunch of things you’ll want to do regularly. Like what, you ask? Well, like concatenating given files, running JSHint on your code, running tests, or minifying your scripts.

Grunt Installation

Links, Resources

Getting Grunt Setup

Getting setup with grunt is pretty easy but there is a dependency you need to install before you get start. First, you needto make sure you have Node on your system.

1) Install NodeJS

Next we need the grunt command line interface.

2) Install the gruntCLI

npm install -g grunt-cli

Now that we have that setup let’s go back to our project, I have some sass code and some javascript files in here that we are going to minify and concat.

First things first we should create a package.json file. A package.json file is a special file that node uses to track dependencies on a project. We can begin creating a package.json file by using the command

npm  init

Next we should add grunt as one of our developer dependencies.

npm install --save-dev grunt

Using this command will install grunt to a new node_modules folder as well as add it as a developer dependency in our package.json file. Developer dependencies are dependencies that are only needed for development and are not necesarilly needed for our application to run.

Grunt relies on having a gruntfile.js so lets create one and do our work there.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s