grunt
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
dateformat | 4.6.3 | 6.15 kB | MIT | prod | |
eventemitter2 | 0.4.14 | 6.79 kB | MIT | prod | |
exit | 0.1.2 | 14.94 kB | MIT | prod | |
findup-sync | 5.0.0 | 2.87 kB | MIT | prod | |
glob | 7.1.7 | 15.41 kB | ISC | prod | |
grunt-cli | 1.4.3 | 3.92 kB | MIT | prod | |
grunt-known-options | 2.0.0 | 2.14 kB | MIT | prod | |
grunt-legacy-log | 3.0.0 | 8.7 kB | MIT | prod | |
grunt-legacy-util | 2.0.1 | 9.39 kB | MIT | prod | |
iconv-lite | 0.6.3 | 186.2 kB | MIT | prod | |
js-yaml | 3.14.1 | 75.07 kB | MIT | prod | |
minimatch | 3.0.8 | 11.57 kB | ISC | prod | |
nopt | 3.0.6 | 10.07 kB | ISC | prod |
Grunt is a powerful JavaScript Task Runner, designed to automate repetitive tasks in the development process. With its numerous plugins, Grunt can handle tasks ranging from linting and minifying files, to unit testing and compiling code, making it an essential tool for any JavaScript developer's toolkit.
To use Grunt, it needs to be installed in your project using npm (Node Package Manager). You can install Grunt by running the following command in your project root:
npm install grunt --save-dev
After installing, you create a 'Gruntfile.js' in your project root where you define your tasks. Here's an example of a basic Gruntfile:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), // Read the package.json file
uglify: { // Task for uglifying JavaScript files
my_target: {
files: {
'dest/output.min.js': ['src/input1.js', 'src/input2.js'] //uglified output of input js files
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task(s).
grunt.registerTask('default', ['uglify']);
};
Once you've defined your tasks in the Gruntfile, you can run them from the command line with:
grunt <task-name>
For the default task, simply run grunt
with no arguments.
The Grunt documentation is available on the official Grunt website gruntjs.com. Here, you will find detailed guides and tutorials on how to use Grunt, configure Grunt tasks, create your own Grunt plugins, and much more. The support and contributing guidelines can also be accessed from the website.