Search code examples
javascriptgruntjsgrunt-contrib-uglify

Grunt uglify - replace original file


I have an angular application that uses require.js to load all scripts. The application is deployed to the web server using Hudson CI. When the deploy job runs, I want to:

  1. Minify all JavaScript files but preserve the original file names so that the require.js config file works out of the box.
  2. Have an option to exclude specific JavaScript files while running uglify.

The JS files are distributed all across the application, which has an ontology similar to the following:

app/
    common/
    controllers/
    factories/
    services/
assets/
    js/

Is there a way to do this?


Solution

  • you need grunt-contrib-uglify

    for the excluding files requirement:

    http://gruntjs.com/configuring-tasks#files