Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Getting Started with Grunt: The JavaScript Task Runner
  • Table Of Contents Toc
  • Feedback & Rating feedback
Getting Started with Grunt: The JavaScript Task Runner

Getting Started with Grunt: The JavaScript Task Runner

By : Jaime Pillora, Bocoup LLC
4.4 (10)
close
close
Getting Started with Grunt: The JavaScript Task Runner

Getting Started with Grunt: The JavaScript Task Runner

4.4 (10)
By: Jaime Pillora, Bocoup LLC

Overview of this book

Table of Contents (12 chapters)
close
close

Project setup


Now we have installed Node.js, npm and Grunt, we're ready to create our first Grunt environment. Let's say we've already built a website, now we want to use Grunt to minify our assets. In this section, we'll learn about the two required files: the package.json file and the Gruntfile.js file, as well as a recommended directory structure.

package.json

The package.json file is a package descriptor; it is used to store all metadata about the module, such as name, version, description, author, repository, and more. It's the single file required to effectively use npm, therefore, the package.json file can also be thought of as the "npm file". As the file extension would suggest, it must be in the JavaScript Object Notation (JSON) data format. If the JSON syntax is invalid, npm will display an error when reading this file. Using a package.json file in our project has many benefits. These include: making it easy to reinstall our dependencies by defining a dependencies field; letting...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete