Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Uglify.js custom configuration inside Gruntfile being ignored. #582

Closed
radiodario opened this Issue Oct 4, 2012 · 5 comments

Comments

Projects
None yet
3 participants

I'm struggling to get my application built because the minifier is renaming all variables named "$super" on one of my libraries (rickshaw.js)
I've tried adding the following to gruntfile.js but i haven't been successful:

    // we dont want to rename the $super things
    uglify: {
     mangle: {
        except: ['$super']
      }
    },

I found a way to change the uglify configuration, but i had to go deep inside yeoman's installation, and make a system-wide change.
it seems uglify options on the gruntfile inside a project are being ignored - so i had to add the above in the min.js file inside /node_modules/yeoman/node_modules/grunt/tasks/min.js - but this is a system-wide change:

// Merge task-specific and/or target-specific options with these defaults.
    var options = this.options({
      separator: null,
      banner: grunt.config('banner') || '',
      uglify: {
        mangle: {
          except: ['$super']
        }
      }
    });
Owner

addyosmani commented Oct 4, 2012

Quick question: is your project being correctly build when you run yeoman build or is it failing (as well as causing the issues above)? We'll investigate what we can do to resolve this issue. I assume the answer to this is yes, but do you also run into the same minification issues with rickshaw when running with stock Uglify outside of yeoman?

It's building correctly, but the instructions to uglify is being ignored when it is placed on the project's gruntfile

Owner

sindresorhus commented Oct 10, 2012

We're in a kinda awkward position, since we chose to go with grunt 0.4, which was supposed to be release before yeoman. This didn't happen, and we're now using a dev version of grunt. Which has some differences with the stable one.

You need to specify your options on the min task:

min: {
    options: {
        mangle: {
            except: ['$super']
        }
    }
},

Unfortunately, that doesn't seem to make any difference, '$super' gets
minified still.

On Wed, Oct 10, 2012 at 12:25 PM, Sindre Sorhus notifications@github.comwrote:

We're in a kinda awkward position, since we chose to go with grunt 0.4,
which was supposed to be release before yeoman. This didn't happen, and
we're now using a dev version of grunt. Which has some differences with the
stable one.

You need to specify your options on the min task:

min: {
options: {
mangle: {
except: ['$super']
}
}},


Reply to this email directly or view it on GitHubhttps://github.com/yeoman/yeoman/issues/582#issuecomment-9297942.

@sindresorhus sindresorhus reopened this Oct 26, 2012

Owner

sindresorhus commented Jan 31, 2013

This is fixed in 1.0. Will be out soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment