Grunt
(Redirected from Grunts)
Original author(s) | Ben Alman |
---|---|
Developer(s) | Grunt Team |
Stable release | 1.4.1
|
Repository |
|
Written in | JavaScript |
Engine | |
Operating system | Cross-platform |
Platform | Node.js |
Type | Task runner |
License | MIT License |
Grunt is a JavaScript task runner, a tool used to automate repetitive tasks in the development workflow. It is built on top of Node.js and is widely used in the web development community to streamline tasks such as minification, compilation, unit testing, and linting.
Overview[edit | edit source]
Grunt is designed to be easy to use and highly extensible. It uses a Gruntfile to define tasks and load Grunt plugins. The Grunt ecosystem includes a large number of plugins that can be used to perform various tasks, making it a versatile tool for developers.
Features[edit | edit source]
- Task Automation: Grunt can automate a wide range of tasks, including file concatenation, minification, image optimization, and more.
- Extensibility: With a vast array of plugins available, Grunt can be extended to perform almost any task.
- Configuration: Tasks are configured in a Gruntfile, which is a JavaScript or JSON file that specifies the tasks and their configurations.
- Community Support: Grunt has a large and active community, providing a wealth of plugins and support.
Usage[edit | edit source]
To use Grunt, you need to have Node.js and npm (software) installed. You can then install Grunt and its plugins via npm. The basic steps to use Grunt are: 1. Install Grunt CLI globally: `npm install -g grunt-cli` 2. Create a `package.json` file: `npm init` 3. Install Grunt and plugins: `npm install grunt --save-dev` 4. Create a `Gruntfile.js` to configure tasks.
Example Gruntfile[edit | edit source]
Below is an example of a simple Gruntfile that defines a task to concatenate and minify JavaScript files: ```javascript module.exports = function(grunt) {
// Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { options: { separator: ';', }, dist: { src: ['src//*.js'], dest: 'dist/<%= pkg.name %>.js', }, }, uglify: { dist: { files: { 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>'] } } } }); // Load the plugins. grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); // Default task(s). grunt.registerTask('default', ['concat', 'uglify']);
}; ```
Related Pages[edit | edit source]
See Also[edit | edit source]
Search WikiMD
Ad.Tired of being Overweight? Try W8MD's physician weight loss program.
Semaglutide (Ozempic / Wegovy and Tirzepatide (Mounjaro / Zepbound) available.
Advertise on WikiMD
WikiMD's Wellness Encyclopedia |
Let Food Be Thy Medicine Medicine Thy Food - Hippocrates |
Translate this page: - East Asian
中文,
日本,
한국어,
South Asian
हिन्दी,
தமிழ்,
తెలుగు,
Urdu,
ಕನ್ನಡ,
Southeast Asian
Indonesian,
Vietnamese,
Thai,
မြန်မာဘာသာ,
বাংলা
European
español,
Deutsch,
français,
Greek,
português do Brasil,
polski,
română,
русский,
Nederlands,
norsk,
svenska,
suomi,
Italian
Middle Eastern & African
عربى,
Turkish,
Persian,
Hebrew,
Afrikaans,
isiZulu,
Kiswahili,
Other
Bulgarian,
Hungarian,
Czech,
Swedish,
മലയാളം,
मराठी,
ਪੰਜਾਬੀ,
ગુજરાતી,
Portuguese,
Ukrainian
Medical Disclaimer: WikiMD is not a substitute for professional medical advice. The information on WikiMD is provided as an information resource only, may be incorrect, outdated or misleading, and is not to be used or relied on for any diagnostic or treatment purposes. Please consult your health care provider before making any healthcare decisions or for guidance about a specific medical condition. WikiMD expressly disclaims responsibility, and shall have no liability, for any damages, loss, injury, or liability whatsoever suffered as a result of your reliance on the information contained in this site. By visiting this site you agree to the foregoing terms and conditions, which may from time to time be changed or supplemented by WikiMD. If you do not agree to the foregoing terms and conditions, you should not enter or use this site. See full disclaimer.
Credits:Most images are courtesy of Wikimedia commons, and templates Wikipedia, licensed under CC BY SA or similar.
Contributors: Prab R. Tumpati, MD