Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-contrib-uglify

Package Overview
Dependencies
Maintainers
9
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-contrib-uglify

Minify JavaScript files with UglifyJS

  • 5.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
340K
increased by1.66%
Maintainers
9
Weekly downloads
 
Created

What is grunt-contrib-uglify?

The grunt-contrib-uglify package is a Grunt plugin that provides the ability to minify JavaScript files using UglifyJS. It helps in reducing the file size of JavaScript files by removing unnecessary characters, comments, and whitespace, which can improve the performance of web applications.

What are grunt-contrib-uglify's main functionalities?

Minify JavaScript files

This feature allows you to minify multiple JavaScript files into a single output file. The code sample demonstrates how to configure the grunt-contrib-uglify task to take two input files (input1.js and input2.js) and produce a minified output file (output.min.js).

{
  "uglify": {
    "my_target": {
      "files": {
        "dest/output.min.js": ["src/input1.js", "src/input2.js"]
      }
    }
  }
}

Generate source maps

This feature allows you to generate source maps for the minified JavaScript files. Source maps help in debugging by mapping the minified code back to the original source code. The code sample shows how to configure the grunt-contrib-uglify task to generate a source map file (output.map) along with the minified output file (output.min.js).

{
  "uglify": {
    "my_target": {
      "options": {
        "sourceMap": true,
        "sourceMapName": "dest/output.map"
      },
      "files": {
        "dest/output.min.js": ["src/input1.js", "src/input2.js"]
      }
    }
  }
}

Customize UglifyJS options

This feature allows you to customize the UglifyJS options for the minification process. The code sample demonstrates how to configure the grunt-contrib-uglify task to disable variable name mangling and remove console statements from the output file (output.min.js).

{
  "uglify": {
    "my_target": {
      "options": {
        "mangle": false,
        "compress": {
          "drop_console": true
        }
      },
      "files": {
        "dest/output.min.js": ["src/input1.js", "src/input2.js"]
      }
    }
  }
}

Other packages similar to grunt-contrib-uglify

Keywords

FAQs

Package last updated on 21 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc