Grunt

From WikiMD's Wellness Encyclopedia

Grunt
Original author(s)Ben Alman
Developer(s)Grunt Team
Stable release
1.4.1
Repository
  • {{URL|example.com|optional display text}}Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
Written inJavaScript
Engine
    Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
    Operating systemCross-platform
    PlatformNode.js
    TypeTask runner
    LicenseMIT 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]

    Template:JavaScript-stub

    WikiMD
    Navigation: Wellness - Encyclopedia - Health topics - Disease Index‏‎ - Drugs - World Directory - Gray's Anatomy - Keto diet - Recipes

    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

    WikiMD is not a substitute for professional medical advice. 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